Re: [PHP] smarter code (mySQL arrays)

2002-01-21 Thread Bogdan Stancescu
...or if you don't know where it's going to end up and you don't know if you're able to disable them you can use this function instead of addslashes() - which is what I do: // Bogdan Stancescu <[EMAIL PROTECTED]>, 2001 function gpc_slashes($unslashed) { if (phpversion()>=4) { if (

Re: [PHP] smarter code (mySQL arrays)

2002-01-21 Thread Michael Sims
> > Just curious, but why are you having to stripslashes() on the data coming > > out of the database? Do you have magic_quotes_runtime enabled on your > server? > >I honestly don't know... all I know is that I'm adding slashes on the >way into the database, and stripping them on the way out, b

Re: [PHP] smarter code (mySQL arrays)

2002-01-21 Thread Jim Lucas [php]
Lucas bend.com - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "php" <[EMAIL PROTECTED]> Sent: Monday, January 21, 2002 4:12 PM Subject: [PHP] smarter code (mySQL arrays) > Hi all, > > I've got into the habbit of pulling data

Re: [PHP] smarter code (mySQL arrays)

2002-01-21 Thread Justin French
Many thanks to both Michael and Bogdan. Michael Sims wrote: > Just curious, but why are you having to stripslashes() on the data coming > out of the database? Do you have magic_quotes_runtime enabled on your server? I honestly don't know... all I know is that I'm adding slashes on the way int

Re: [PHP] smarter code (mySQL arrays)

2002-01-21 Thread Michael Sims
At 11:12 AM 1/22/2002 +1100, Justin French wrote: >Hi all, > >I've got into the habbit of pulling data out of a table something like this: [...] > $id = $sql_myrow["id"]; > $date = $sql_myrow["date"]; [...] >Now, I reckon there must be a way of automating the task of making the >$title var out

Re: [PHP] smarter code (mySQL arrays)

2002-01-21 Thread Bogdan Stancescu
function make_vars($result) { $fields = mysql_num_fields($result); if ($myrow = mysql_fetch_array($result)){ for ($i=0; $i < $fields; ++$i){ // > $names = mysql_fieldname($result,$i); global $$names; $$names = $myrow[$names]; } return true; }else{

[PHP] smarter code (mySQL arrays)

2002-01-21 Thread Justin French
Hi all, I've got into the habbit of pulling data out of a table something like this: $sql = "SELECT * FROM cd_review WHERE publish='yes' ORDER BY id DESC LIMIT 3"; $sql_result = mysql_query($sql); print mysql_error(); while ($sql_myrow = mysql_fetch_array($sql_result)) { // pull out the dat