473,602 Members | 2,809 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 3814

"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
7376
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
2542
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
4987
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
2354
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
1758
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
5825
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
8254
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
3366
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
1771
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
7921
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
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8056
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
8270
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
6730
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...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3901
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2424
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

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.