I have PHP 5.whatever on my local machine, the host for a site I'm working on seems to have PHP 4 - or at least it doesn't support the mysql object (when I use mysqli_connect it claims that it is an undefined function).
So I'm just using the standard mysql_connect. Now, the mysql link seems OK, because in the included database connection definition file, I put in this code:
$dbc = mysql_connect('localhost',
Problem does not get echoed.
In the problematic file (which, by the way, is a form), I've echoed the SQL that is being generated and plugged that straight into the database. When I do so it works fine.
So somewhere there is a problem, in the code attached below, because 'problem2', as below, DOES echo. The query syntax is fine, the link SEEMS ok, so where is the problem in the 3 lines in between?
Thanks a lot. This is driving me a bit nuts :)
$q = "INSERT INTO users (first_name, last_name, company_name, email, telephone) VALUES ('$firstname', '$lastname', '$company', '$email', '$phone')";
$r = mysql_query($q, $dbc);
$num = mysql_affected_rows($dbc);
$id = mysql_insert_id($dbc);