English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

$imgres = mysql_db_query("database", "select ID, URL1 from contacts where ID=$idno;");
$imgdata = mysql_fetch_row($imgres);
echo mysql_error();
?>

appropriate alt



This code doesn't seem to work....I've tried everything....here's the error messages I'm getting when trying to view it in the browser....

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/nethinga/public_html/Unt... on line 8
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

What I really don't understand, is that it worked earlier, and I messed with it and now it doesn't. I'm SOOOO FRUSTRATED with this....please help!@!@!@

2006-09-18 03:15:13 · 3 answers · asked by E M 1 in Computers & Internet Programming & Design

3 answers

First off I'm going to suggest you look here http://uk2.php.net/manual/en/function.mysql-db-query.php
says that the function is depreciated.

It also looks like you have a semi colon that shouldn't be there

"select ID, URL1 from contacts where ID=$idno;<- (not sure that should be there)");

hope it helps

for eg

$sql = "INSERT
INTO users (reg_username,
reg_password,
reg_email)
VALUES ('bad_guy', 'mypass', ''), ('good_guy',
'1234',
'shiflett@php.net')"; ?>

taken from http://phpsec.org/projects/guide/3.html

2006-09-18 03:25:01 · answer #1 · answered by confus3d1234 1 · 0 0

this isn't a problem with the depreciated function, especially if you are still using PHP 4.x

the problem is in your sql statement. I know the ";" should not be after idno, also, to optimise your code, you should include $idno in quotes (single ' work). Doing this last will make sure that the index is used, often if the quotes are omitted the index is ignored.

2006-09-18 11:07:00 · answer #2 · answered by John J 6 · 0 0

Well, mysql_db_query is deprecated (going out of use). Use mysql_connect, and then mysql_query. Make sure the variable $idno is correct, you can hardcode it yourself and see if it works that way. (I.e, try "select ID, URL1 from contacts where ID=1" if you know you have a row where ID=1 in your table.)

2006-09-18 10:23:13 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers