I'm a novice, so bear with me.
I'm trying to use a query string that has worked fine for me in the past, however, I'm now using mysql 5 which may be causing the problem, or not.
I've tried various versions of this with still no joy.
Here is my mysql_error message... Query failed:
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 'desc='Page Description', keywords='Page Keywords', content='
Page content html' at line 1
Here is my code - $str = "UPDATE pages SET title='".$pagetitle."', desc='".$pagedescription."', keywords='".$pagekeywords."', content='".$pagecontent."' WHERE id = '1'";
-
mysql_query($str) or die("Query failed:<br>".mysql_error());
many thanks in advance.
3 1551
what does the printed query string look like?
Hi there,
Thanks for the message.
Here is what is printed...
UPDATE pages SET title='Page Title', desc='Page Description', keywords='Page Keywords', content='
Page content html
' WHERE id = '1'
There appears to be somthing funny going on with the content field.
Here is my whole page... Atli 5,058
Expert 4TB
Hey.
The word "DESC" is a reserved keyword in MySQL. If you want to use it as a column name, it needs to be enclosed in back-ticks (`desc`).
Also, a couple of notes on your code: - Check out SQL Injection. Your code is wide open to an SQL Injection attack. - Basically; always run input variables through mysql_real_escape_string before using them in a MySQL query.
- You don't have to break out of a double-quoted string to add a variable. PHP parses variables within double-quoted strings.
- // Instead of this:
-
$string = " Hello, " . $world;
-
-
// Just do this:
-
$string = " Hello, $world";
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dogu |
last post by:
Noob alert.
Code is below.
File is saved as a .php.
What I'm trying to do:
User uses 'select' box drop down list to pick a value.
Value ($site) is derived from a db query. This works fine....
|
by: Wescotte |
last post by:
Here is a small sample program I wrote in PHP (running off Apache
1.3.31 w/ PHP 5.0.1) to help illustrates problem I'm having. The data
base is using DB2 V5R3M0. The client is WinXP machine using...
|
by: Bruce W...1 |
last post by:
I do a query to MySQL using PHP. Well actually I do too many of them
which is the problem, it's too slow. I think maybe an inner join or
something would be better but I can't figure this out.
...
|
by: George Copeland |
last post by:
This is a request for help fixing a SQL Server 2000/ADO problem on Windows
XP. I would appreciate any useful assistance.
PROBLEM: SQL Server access on my machine fails as follows:
1. All of...
|
by: shreedhar |
last post by:
If I try to delete a record from my table which is giving following error
Warning: PostgreSQL query failed: ERROR: pg_atoi: zero-length string in
/xxx/database.inc on line 73
What might be...
|
by: Andy |
last post by:
Hello,
I am having many problems with setting up a parameter query that
searches by the criteria entered or returns all records if nothing is
entered.
I have designed an unbound form with 3...
|
by: Miks |
last post by:
The database scheme consists of four relations:
Product(maker, model, type)
PC(code, model, speed, ram, hd, cd, price)
Laptop(code, model, speed, ram, hd, screen, price)
Printer(code, model,...
|
by: Pradeep83 |
last post by:
Hi All
Problem : I am unable to retrieve the data from the table in postgres database using C application which i have written in solaris os.
Query: How to check whether connection is there...
|
by: ARC |
last post by:
Hello all,
So I'm knee deep in this import utility program, and am coming up with all
sorts of "gotcha's!".
1st off. On a "Find Duplicates Query", does anyone have a good solution for...
|
by: ddtpmyra |
last post by:
Hi below is my script displaying all the information inside the table.
Pupose:
pupose of this php page is to display all the information on my table and have a check box at the last column that...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |