By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,967 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,967 IT Pros & Developers. It's quick & easy.

Problem with mysql_query

P: n/a
Hi!

Iīm trying to execute a query, but I receive an error ("error in
executing"). The strange thing is that the $link sentence has no
errors, so the connection is fine.

$server="localhost";
$database="mydatabase";
$dbpass="mypass";
$dbuser="myuser";

$link=mysql_connect($server,$dbuser,$dbpass)
or die ("couldnīt connect");

mysql_query('update articulos set rank=rank + 1 where id=$id', $link)
or die ("error in executing");

Any suggestion?

Thanks!

Ezequiel

Mar 3 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
zek2005 wrote:
Hi!

Iīm trying to execute a query, but I receive an error ("error in
executing"). The strange thing is that the $link sentence has no
errors, so the connection is fine.

$server="localhost";
$database="mydatabase";
$dbpass="mypass";
$dbuser="myuser";

$link=mysql_connect($server,$dbuser,$dbpass)
or die ("couldnīt connect");

mysql_query('update articulos set rank=rank + 1 where id=$id', $link)
or die ("error in executing");

Any suggestion?

Thanks!

Ezequiel
Yea, figure out what MySQL doesn't like about it. Check out mysql_error().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 3 '07 #2

P: n/a
On 3 mar, 03:54, Jerry Stuckle <jstuck...@attglobal.netwrote:
zek2005 wrote:
Hi!
Iīm trying to execute a query, but I receive an error ("error in
executing"). The strange thing is that the $link sentence has no
errors, so the connection is fine.
$server="localhost";
$database="mydatabase";
$dbpass="mypass";
$dbuser="myuser";
$link=mysql_connect($server,$dbuser,$dbpass)
or die ("couldnīt connect");
mysql_query('update articulos set rank=rank + 1 where id=$id', $link)
or die ("error in executing");
Any suggestion?
Thanks!
Ezequiel

Yea, figure out what MySQL doesn't like about it. Check out mysql_error().

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Ocultar texto de la cita -

- Mostrar texto de la cita -
I receive the following error:

"No database selected"

but shouldn't I receive that error before when I do the connection in
$link ???

Thanks!

Mar 3 '07 #3

P: n/a
..oO(zek2005)
>I receive the following error:

"No database selected"

but shouldn't I receive that error before when I do the connection in
$link ???
Connecting to a server and selecting a DB are two different things.

http://www.php.net/mysql_connect
http://www.php.net/mysql_select_db

Micha
Mar 3 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.