hi folks. thanks for taking time out to read this.
i've been doing database stuffs with php for about a month now.
i've managed, during that time, to create a database, get php to connect to it and get php to display database info.
i only recently encountered the problem that i was unable to actually write to the databse from the browser.
i use phpmyadmin to update records (its a mysql database running on a windows server).
when i try and use the INSERT statement in a php document it returns a
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in \\host\path\to\add\doc.php on line 76
error.
Line 76: while ($row = mysql_fetch_array($result)) :
this $result variable refers to an include, which has the actual sql query in it.
$relationships =
INSERT INTO titles (jobtitle,
payrate,
shiftpattern,
qualifications,
location,
description)
VALUES ('$jobtitle',
'$payrate',
'$shiftpattern',
'$qualifications',
'$location',
'$description');
";
the variables are all passed over from a form.
i'm pretty sure i'm doing something very wrong, i just don't know what. all the database/table names are correct, and i know that it's connecting.
my eventual aim, is that when the user presses submit on the form page, the information is inserted (using the above query), and then on the same page, will display the record that was just added.
anyone know what i might be doing wrong?
i know there is potentially a billion things that could be wrong with my code/connection/etc - so if you need some more information about my scripts/stuff then ask..