trying to set a page to insert into a database.
I think the problem may be that I have included both the form, and the should-be-displayed data on the same page, but I wanted to clarify before I try and change it. (the page I am quoting is insert2.php)
Following, is the problem line, when I comment this line out, the page loads fine (doesnt do anything but loads ok), but if I uncomment it, the page loads as absolutely blank:
[FONT=monospace][COLOR=#990000]mysql_query[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000ff]"insert into test1 values('[COLOR=#006699][B]$1[/B][/COLOR]', '[COLOR=#006699][B]$2[/B][/COLOR]', '[COLOR=#006699][B]$3[/B][/COLOR]', '[COLOR=#006699][B]$4[/B][/COLOR]', '[COLOR=#006699][B]$5[/B][/COLOR]', '[COLOR=#006699][B]$6[/B][/COLOR]', '[COLOR=#006699][B]$7[/B][/COLOR]', '[COLOR=#006699][B]$8[/B][/COLOR]', '[COLOR=#006699][B]$9[/B][/COLOR]', '[COLOR=#006699][B]$10[/B][/COLOR]', '[COLOR=#006699][B]$11[/B][/COLOR]', '[COLOR=#006699][B]$12[/B][/COLOR]', '[COLOR=#006699][B]$13[/B][/COLOR]', '[COLOR=#006699][B]$14[/B][/COLOR]')"[/COLOR][COLOR=#009900])[/COLOR][/FONT]
Would really appreciate any help, as can't seem to get round this. Cheers.
Hey you, add something to my base of data, I DARE you!!! <br><br>
<form name="form" action="insert2.php" method="post">
<table>
<tr><td>First Name:</td><td><input type="text" name="1" /></td></tr>
<tr><td>Surname:</td><td><input type="text" name="2" /></td></tr>
<tr><td>Address Line 1:</td><td><input type="text" name="3" /></td></tr>
<tr><td>City:</td><td><input type="text" name="4" /></td></tr>
<tr><td>County:</td><td><input type="text" name="5" /></td></tr>
<tr><td>Postcode:</td><td><input type="text" name="6" /></td></tr>
<tr><td>Telephone - Home:</td><td><input type="text" name="7" /></td></tr>
<tr><td>Telephone - Mobile:</td><td><input type="text" name="8" /></td></tr>
<tr><td>Email:</td><td><input type="text" name="9" /></td></tr>
<tr><td>Bike Manufacturer:</td><td><input type="text" name="10" /></td></tr>
<tr><td>Bike Model:</td><td><input type="text" name="11" /></td></tr>
<tr><td>Bike Colour:</td><td><input type="text" name="12" /></td></tr>
<tr><td>Bike Serial Number:</td><td><input type="text" name="13" /></td></tr>
<tr><td>ID:</td><td><input type="text" name="14" /></td></tr>
</table>
<input type="submit" name="Submit" value="Submit" />
</form>
[COLOR=#000000][B]<?php[/B][/COLOR]
$1 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'1'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$2 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'2'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$3 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'3'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$4 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'4'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$5 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'5'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$6 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'6'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$7 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'7'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$8 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'8'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$9 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'9'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$10 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'10'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$11 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'11'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$12 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'12'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$13 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'13'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
$14 [COLOR=#339933]=[/COLOR] [COLOR=#339933]@[/COLOR][COLOR=#000088]$_POST[/COLOR][COLOR=#009900][[/COLOR][COLOR=#0000ff]'14'[/COLOR][COLOR=#009900]][/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#000088]$db_host[/COLOR] [COLOR=#339933]=[/COLOR] [COLOR=#0000ff]'notactualhost'[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#000088]$db_user[/COLOR] [COLOR=#339933]=[/COLOR] [COLOR=#0000ff]'notactualuser'[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#000088]$db_pwd[/COLOR] [COLOR=#339933]=[/COLOR] [COLOR=#0000ff]'notactualpw'[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#000088]$database[/COLOR] [COLOR=#339933]=[/COLOR] [COLOR=#0000ff]'notactualdb'[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#000088]$table[/COLOR] [COLOR=#339933]=[/COLOR] [COLOR=#0000ff]'test1'[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#b1b100]if[/COLOR] [COLOR=#009900]([/COLOR][COLOR=#339933]![/COLOR][COLOR=#990000]mysql_connect[/COLOR][COLOR=#009900]([/COLOR][COLOR=#000088]$db_host[/COLOR][COLOR=#339933],[/COLOR] [COLOR=#000088]$db_user[/COLOR][COLOR=#339933],[/COLOR] [COLOR=#000088]$db_pwd[/COLOR][COLOR=#009900])[/COLOR][COLOR=#009900])[/COLOR]
[COLOR=#990000]die[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000ff]"Can't connect to database"[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#b1b100]if[/COLOR] [COLOR=#009900]([/COLOR][COLOR=#339933]![/COLOR][COLOR=#990000]mysql_select_db[/COLOR][COLOR=#009900]([/COLOR][COLOR=#000088]$database[/COLOR][COLOR=#009900])[/COLOR][COLOR=#009900])[/COLOR]
[COLOR=#990000]die[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000ff]"Can't select database"[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#990000]mysql_query[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000ff]"insert into test1 values('[COLOR=#006699][B]$1[/B][/COLOR]', '[COLOR=#006699][B]$2[/B][/COLOR]', '[COLOR=#006699][B]$3[/B][/COLOR]', '[COLOR=#006699][B]$4[/B][/COLOR]', '[COLOR=#006699][B]$5[/B][/COLOR]', '[COLOR=#006699][B]$6[/B][/COLOR]', '[COLOR=#006699][B]$7[/B][/COLOR]', '[COLOR=#006699][B]$8[/B][/COLOR]', '[COLOR=#006699][B]$9[/B][/COLOR]', '[COLOR=#006699][B]$10[/B][/COLOR]', '[COLOR=#006699][B]$11[/B][/COLOR]', '[COLOR=#006699][B]$12[/B][/COLOR]', '[COLOR=#006699][B]$13[/B][/COLOR]', '[COLOR=#006699][B]$14[/B][/COLOR]')"[/COLOR][COLOR=#009900])[/COLOR] or [COLOR=#990000]die[/COLOR][COLOR=#009900]([/COLOR][COLOR=#990000]mysql_error[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#b1b100]echo[/COLOR] [COLOR=#0000ff]"inserted into db"[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#000000][B]?>[/B][/COLOR]


Sign In
Create Account


Back to top









