473,663 Members | 2,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help : Mysql / PHP : syntax error

Hello,

I need help for php syntax when i call Mysql database

I have wrote that and my sql connection is working

I just have a problem with this command line :

$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";
$acces = mysql_query($qu ery);
PS : Login = Julien
Thanks to help me and to give me correct syntax
Julien from France
Jul 17 '05 #1
7 3817

"Julien - Marseille" <be************ @hotmail.com> schreef in bericht
news:bk******** **@s1.read.news .oleane.net...
Hello,

I need help for php syntax when i call Mysql database

I have wrote that and my sql connection is working

I just have a problem with this command line :

$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";
$acces = mysql_query($qu ery);
PS : Login = Julien
Thanks to help me and to give me correct syntax
Julien from France


$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";

should be:

$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login'";

(delete the semicolon after ...'$login'.... .)

A la tienne!

Marcel
Jul 17 '05 #2
Julien - Marseille wrote:
Hello,

I need help for php syntax when i call Mysql database

I have wrote that and my sql connection is working

I just have a problem with this command line :

$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";
$acces = mysql_query($qu ery);
PS : Login = Julien
Thanks to help me and to give me correct syntax
Julien from France

hi,
i think your $login variable is not evaluated because it's enclosed by
simple quotes that override the variable evaluation mechanism.
you've got to write :
"SELECT * FROM utilisateurs WHERE pseudo_utilisat eur='".$login." ';"
cheers.

Jul 17 '05 #3
On Wed, 24 Sep 2003 16:54:06 +0200, cédric wrote:
$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";
$acces = mysql_query($qu ery);
PS : Login = Julien
Thanks to help me and to give me correct syntax
Julien from France

hi,
i think your $login variable is not evaluated because it's enclosed by
simple quotes that override the variable evaluation mechanism. you've got
to write :
"SELECT * FROM utilisateurs WHERE pseudo_utilisat eur='".$login." ';"
cheers.

Nope.. the $var is perfectly fine within single quotes like that, because
the _actual_ string is enclosed in double-quotes (" ").. the singles are
quoted as _part_ of the string, not as a string definition. However:
$query = "
SELECT *
FROM utilisateurs
WHERE pseudo_utilisat eur = '$login'
";
$acces = mysql_query($qu ery);
should work.

Notice the semi-colon has been dropped after '$login'. I suspect (without
seeing any other posts in this thread) that this is causing a problem.

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
Programming, Web design, development & hosting.

Jul 17 '05 #4

On 24-Sep-2003, "Julien - Marseille" <be************ @hotmail.com> wrote:
I need help for php syntax when i call Mysql database
I have wrote that and my sql connection is working
I just have a problem with this command line :

$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";
$acces = mysql_query($qu ery);
PS : Login = Julien


The code you have shown us is correct, assuming that the table name and
column name are correct, the db is open, mysql is installed, etc.

What syntax error are you getting? If you add 'or die(mysql_error ())' after
the mysql_query(), you will get an error message if you have a mysql syntax
error.

Contrary to other posts, the semicolon in the SQL string is not needed, but
not an error and the 's around the $login are correct, too.
--
Tom Thackrey
www.creative-light.com
Jul 17 '05 #5
Ben
"Julien - Marseille" <be************ @hotmail.com> wrote in message news:<bk******* ***@s1.read.new s.oleane.net>.. .
Hello,

I need help for php syntax when i call Mysql database

I have wrote that and my sql connection is working

I just have a problem with this command line :

$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";
$acces = mysql_query($qu ery);
PS : Login = Julien
Thanks to help me and to give me correct syntax
Julien from France


Je ne sais pas si le problème est réglé mais as-tu essayé de mettre 2 signes "=" ?

....where '$var1' == '$var2'...

benoit
québec
Jul 17 '05 #6
On 24 Sep 2003 17:26:33 -0700, Ben wrote:
"Julien - Marseille" <be************ @hotmail.com> wrote in message news:<bk******* ***@s1.read.new s.oleane.net>.. .
$query = "SELECT * FROM utilisateurs WHERE
pseudo_utilisat eur='$login';";

You can't have the ";" sent to MySQL.
Remove it from $query and you should be ok.
Anyway ... it always pays to know why something does not work in MySQL:

<?php
$result = mysql_query($qu ery) or die(mysql_error ());
?>

Prints the MySQL error message if there was one in $query.

Je ne sais pas si le problème est réglé mais as-tu essayé de mettre 2 signes "=" ?

...where '$var1' == '$var2'...


(mon francais c'est tres mauvais)
ca ne va pas! En MySQL le test de equalite ce fait avec un seule "=".
Deux signes "=" fonctionne bien en PHP, pas en MySQL.

Mais ... bonne idee :)
--
I have a spam filter working.
To mail me include "urkxvq" (with or without the quotes)
in the subject line, or your mail will be ruthlessly discarded.
Jul 17 '05 #7
I noticed that Message-ID: <bk************ @ID-203069.news.uni-berlin.de>
from Pedro contained the following:
(mon francais c'est tres mauvais)
Mon francais est plus mal. ;-)
ca ne va pas! En MySQL le test de equalite ce fait avec un seule "=".
Deux signes "=" fonctionne bien en PHP, pas en MySQL.

Mais je comprend qu'est-ceque c'est que vous dit. :)
--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
7379
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere. Good food.", " (Harry Houdini - 03/01/2004)"); INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada", " (Herbert Hoover - 03/03/2004)"); INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
23
2546
by: phpfrizzle | last post by:
Hi there, I have a site with products on it. The site has a mysql backend. All products belong to certain series (table series). There can be up to 4 different products (table products) (categories 1-4) in 1 series. Each product has a defined 'series ID' which tells us
0
4990
by: Fatt Shin | last post by:
Hi, I'm running MySQL 4.0.13, connecting from PowerBuilder 9 using ODCB Connector 3.51. I'm facing a problem where whenever I issue a SELECT COUNT(*) statement from PowerBuilder, I always get SQL syntax error back from MySQL. (Refer to ODBC Trace I captured below). metrohouse af8-b94 ENTER SQLExecDirect HSTMT 014D2360 UCHAR * 0x020A0EA2 "select count ( *) from code
0
2356
by: Mario Ohnewald | last post by:
Hello! I want to import a MySQL 3.x Databse to my new shiny MySQL4.x. I did a backup with /usr/local/mysql-standard-4.0.14-pc-linux-i686/bin/mysqldump -u root -p --opt -A > mysql_lamp_backup.`date '+%Y.%m.%d'`.sql And i tried to import it to MySQL4.x with: /usr/local/mysql/bin/mysql -u root -p < mysqlbak The error: ERROR 1064 at line 598: You have an error in your SQL syntax. Check the
0
1760
by: google account | last post by:
*sigh* I have done all that I know how.... I am using fedora core1, I believe. I have updated the MySQL version to 4.0.17-0. I am trying this: rpm -i MySQL-python2.1-0.9.2-1.i386.rpm
4
5831
by: Adam Smith | last post by:
I have a dedicated server running 'FreeBSD 4.9 STABLE' at a hosting site. They have done some default installations, presumably from the CVS ports package ??. Herein lies the problem, "I do not know" what they have done! At first it was apparent that MySQL was installed mysql_install_db ; GRANT TABLES etc. ??? so I ran "mysql_install_db --force"
2
8255
by: speralta | last post by:
My tired old eyes may be failing me, but the following insert statements look correct to me, but I can't seem to get a clean insert from a fairly large text file database into mysql. I was wondering if maybe I'm hitting a limit on character length per line on some insert statements that I'm trying. Here's the error messages: execute failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server...
1
3367
by: ajos | last post by:
hi evrybdy, the problem is:- i had this running before in jsp but when i changed the jsp page using struts tags there occoured a problem... when i enter values in the 2 text boxes and click enter an exception occours which is- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request.
5
1772
by: gsaray101 | last post by:
I am trying to set up one server with multiple mysql dbs. This script will get the mysqldump files from the ftp server and based on the name of the server in the file, it will create the corresponding db on the server. this is the code <?php #ftp the most recent file to the ftp server $dir1="/patrol_media/patadmin/sqlbak"; $dir2="d:\\cacti\\backup";
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8858
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.