Misc Links
Forum Archive
News Archive
File DB
 

Ads
 

Advertisement
 

Latest Forum Topics
wow 56 k modems are
Posted by Red Squirrel
on Oct 14 2013, 11:52:23 pm

I Need A Program
Posted by rovingcowboy
on Sep 23 2013, 5:37:59 pm

having trouble witn lan
Posted by rovingcowboy
on Sep 23 2013, 5:40:56 pm

new problem for me
Posted by rovingcowboy
on Sep 23 2013, 5:54:09 pm

RBC Royal Bank
Posted by Red Squirrel
on Aug 13 2013, 6:48:08 pm

 

Php how-to for starters
Taking web design to the next extreme
By Red Squirrel


Slashes, quotes and stuff
In a typical script that POSTs data, if there is any quotes or slashes that are typed, they will be formatted for php. For example, " will end up like \" and \ will end up like \\ and same with single quotes. To fix that problem, you need to use the stripslashes() function to the variable.

To do this, you simply need to go like this:

$myvariable = stripslashes("this is data with \"quotes\" and slashes\\ and \'single quotes\'");

That string of text could be a variable as well. A $_POST variable that has posted data will always end up like that. This is because in order to write a string with quotes, it has to be in that format. For example, this:

Echo("this is data with \"quotes\" and slashes\\ and \'single quotes\'");

Would show up as this:

this is data with "quotes" and slashes\ and 'single quotes'

If you did not type it that way in the echo function, you'd get a parse error. A parse error is whenever there is a problem with the script. Thankfully, it usually gives you good information and what line it's on, so you can go fix it. Something as simple as a missing semi colon can result in a parse error.

From here, you should be ready to start making simple scripts with php, and move on to more advanced functions.

Red Squirrel / Ryan
Owner, IceTeks.com




spacer
302776 Hits Pages: [1] [2] [3] [4] [5] 28 Comments
spacer


Latest comments (newest first)
Posted by halojoy on June 06th 2005 (22:36)
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
<?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
?>
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 laugh.gif

spacer
Posted by Red Squirrel on November 11th 2004 (14:13)
You need to run it off a webserver that has php installed.

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


spacer
Posted by Red Squirrel on October 10th 2004 (16:32)
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.
spacer
Posted by jewboy419 on October 10th 2004 (15:34)
pressanykey.gif 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!!!
spacer
Posted by sintekk on October 10th 2004 (11:18)
QUOTE (Red Squirrel @ Jul 6 2004, 08:41 PM)
Tripod actually has php amd mysql? That's cool, I did not know that.

Only the European lycos, the US one still believes that everybody that wants a website with them just wants to make a Hillary Duff fan page laugh.gif

...now only if there was a free ColdFusion host out there sad.gif...

spacer
View all comments
Post comment


Top Articles Latest Articles
- What are .bin files for? (669062 reads)
- Text searching in linux with grep (161180 reads)
- Big Brother and Ndisuio.sys (150471 reads)
- PSP User's Guide (139547 reads)
- SPFDisk (Special Fdisk) Partition Manager (117240 reads)
- How to Use MDADM Linux Raid (188 reads)
- What is Cloud Computing? (1225 reads)
- Dynamic Forum Signatures (version 2) (8769 reads)
- Successfully Hacking your iPhone or iTouch (18714 reads)
- Ultima Online Newbie Guide (35906 reads)
corner image

This site best viewed in a W3C standard browser at 800*600 or higher
Site design by Red Squirrel | Contact
© Copyright 2017 Ryan Auclair/IceTeks, All rights reserved