Php how-to for starters

Anything technology related that does not fit in other categories
Anonymous

Php how-to for starters

Post by Anonymous »

:dosgonebad: i am doing a php on euoropean lycos and i get an error when using this code: 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" the first line of the code... can' anyone help!!!

Archived topic from Iceteks, old topic ID:1560, old post ID:22538
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Php how-to for starters

Post by Red Squirrel »

It means you have a syntax error in your mysql query, unfortunatly mysql is not very helpful at telling WHAT the error is, so you'll have to figure that part out. Post the query and maybe I can look at it and find the problem.

Archived topic from Iceteks, old topic ID:1560, old post ID:22539
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Php how-to for starters

Post by Red Squirrel »

You need to run it off a webserver that has php installed.

So you would type http://serverhost/script.php



Archived topic from Iceteks, old topic ID:1560, old post ID:23278
Honk if you love Jesus, text if you want to meet Him!
halojoy
Posts: 19
Joined: Thu Jun 09, 2005 9:18 am

Php how-to for starters

Post by halojoy »

Yes, it is nice with scripts that does note produce notices.
isset is a good way to avoid this,
if you do not want to add a lot of code that sets 'empty' values for variables

Another way is to TURN OFF reporting of NOTICE
you add this, at top (beginning) of your php pages:

Code: Select all

<?php

// Report ALL, but not NOTICE
error_reporting ( E_ALL & ~E_NOTICE );

// You will still get WARNINGS and other real ERRORS
// Notice is not an error, just a note
// To not have to add it in all your pages you can make it a line in 'config.php' ,
//  if you have such a file, that is included by php pages
?>[code]I use E_ALL = reporting with notices only when working with my code
When I am finished and put my code on website, I Turn Notice OFF, using that line.
I do not want to scare my visitors  :lol:  

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:1560, old post ID:27352[/size][/color]
... i make php ... i make it good
Locked