Re: [PHP-DB] Need some help

2005-05-11 Thread Luis Morales
Why not use a sessions ?

once posted your process form, you can store the final results on
session vars and passing the results to other pages.

Take a look on www.php.net on session topic.

Regards,

Luis Morales


Murray @ PlanetThoughtful wrote:

>>Sorry but this isn't working.  The variable $ttl_price is a calculation in
>>my first script.  It stores the value of $Total_Price for all items.  I am
>>trying to pass that to a new page.  It isn't a form that I'm working with,
>>do I need to make it a form?  I would greatly appreciate any help you
>>could
>>offer.
>>
>>
>
>The $_POST[] superglobal is only available to a page directly following a
>page with a form on it, when the form's method set to 'POST'.
>
>Id $ttl_price a single value or an array?
>
>If you are not using a form, you could possibly pass the value on the query
>string, then use $_GET[] in your target page to retrieve the value from the
>query string. This doesn't require the presence of a form on your
>originating page.
>
>Otherwise, you could also use sessions to put the value into a session
>cookie and then retrieve it from the target page, using the $_SESSION
>superglobal.
>
>How are you moving from the page in which the calculation is done to the
>page in which you need the calculation? Ie, do you click on a button, a
>link, do you redirect to the page etc?
>
>Much warmth,
>
>Murray 
>
>  
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Need some help

2005-05-11 Thread Murray @ PlanetThoughtful
> Sorry but this isn't working.  The variable $ttl_price is a calculation in
> my first script.  It stores the value of $Total_Price for all items.  I am
> trying to pass that to a new page.  It isn't a form that I'm working with,
> do I need to make it a form?  I would greatly appreciate any help you
> could
> offer.

The $_POST[] superglobal is only available to a page directly following a
page with a form on it, when the form's method set to 'POST'.

Id $ttl_price a single value or an array?

If you are not using a form, you could possibly pass the value on the query
string, then use $_GET[] in your target page to retrieve the value from the
query string. This doesn't require the presence of a form on your
originating page.

Otherwise, you could also use sessions to put the value into a session
cookie and then retrieve it from the target page, using the $_SESSION
superglobal.

How are you moving from the page in which the calculation is done to the
page in which you need the calculation? Ie, do you click on a button, a
link, do you redirect to the page etc?

Much warmth,

Murray 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some help

2005-05-11 Thread Mark Cain
You could use  a form -- but since this is a db maillist -- maybe you ought
to explore that on one of the other php lists e.g. general.

Mark Cain

- Original Message -
From: "ReClMaples" <[EMAIL PROTECTED]>
To: "Philip Hallstrom" <[EMAIL PROTECTED]>
Cc: "PHP" 
Sent: Wednesday, May 11, 2005 6:28 PM
Subject: RE: [PHP-DB] Need some help


> Sorry but this isn't working.  The variable $ttl_price is a calculation in
> my first script.  It stores the value of $Total_Price for all items.  I am
> trying to pass that to a new page.  It isn't a form that I'm working with,
> do I need to make it a form?  I would greatly appreciate any help you
could
> offer.
>
> Thanks
> -rich
>
> -Original Message-
> From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 11, 2005 4:36 PM
> To: ReClMaples
> Cc: PHP
> Subject: Re: [PHP-DB] Need some help
>
> >   I am having an issue with displaying a variable from another php
script.
> > Can you help please?
> >
> > Here is the code that I'm using:
> >
> >  >
> > $item_ttlprice = $_POST[$ttl_price];
>
> This should at the very least be:
>
> $item_ttlprice = $_POST[ttl_price];  // remove the last dolalr sign
>
> Also, if youre HTML form's action is GET then you should replace POST with
> GET...
>
>
>
>
> > ?>
> > 
> > 
> > Your price is: $
> >  > echo $item_ttlprice;
> > ?>
> > 
> > 
> >
> > pretty simple I would think but I can't figure out what I'm doing wrong.
> > The above is the new script.  Below is the script that the $ttl_price is
> > coming from:
> >
> > td align=center>\$ $item_price 
> >$item_qty 
> >\$ $total_price
> > > href=\"removefromcart.php?id=$id\">remove
> >";
> > $ttl_price = $ttl_price + $total_price;
> >
> >
> > Can anyone tell me what I'm doing wrong?
> >
> > I have tried changing this part:
> >
> >  >
> > $item_ttlprice = $_POST[$ttl_price];
> > ?>
> >
> > to $item_ttlprice = $_GET[ttl_price];
> >
> > to $item_ttlprice = $_POST['$ttl_price'];
> >
> > nothing seems to work.
> >
> >
> > Thanks for your help
> > -Rich
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Need some help

2005-05-11 Thread ReClMaples
Sorry but this isn't working.  The variable $ttl_price is a calculation in
my first script.  It stores the value of $Total_Price for all items.  I am
trying to pass that to a new page.  It isn't a form that I'm working with,
do I need to make it a form?  I would greatly appreciate any help you could
offer.

Thanks
-rich

-Original Message-
From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 11, 2005 4:36 PM
To: ReClMaples
Cc: PHP
Subject: Re: [PHP-DB] Need some help

>   I am having an issue with displaying a variable from another php script.
> Can you help please?
>
> Here is the code that I'm using:
>
> 
> $item_ttlprice = $_POST[$ttl_price];

This should at the very least be:

$item_ttlprice = $_POST[ttl_price];  // remove the last dolalr sign

Also, if youre HTML form's action is GET then you should replace POST with
GET...




> ?>
> 
> 
> Your price is: $
>  echo $item_ttlprice;
> ?>
> 
> 
>
> pretty simple I would think but I can't figure out what I'm doing wrong.
> The above is the new script.  Below is the script that the $ttl_price is
> coming from:
>
> td align=center>\$ $item_price 
>$item_qty 
>\$ $total_price
> href=\"removefromcart.php?id=$id\">remove
>";
> $ttl_price = $ttl_price + $total_price;
>
>
> Can anyone tell me what I'm doing wrong?
>
> I have tried changing this part:
>
> 
> $item_ttlprice = $_POST[$ttl_price];
> ?>
>
> to $item_ttlprice = $_GET[ttl_price];
>
> to $item_ttlprice = $_POST['$ttl_price'];
>
> nothing seems to work.
>
>
> Thanks for your help
> -Rich
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some help

2005-05-11 Thread Philip Hallstrom
  I am having an issue with displaying a variable from another php script.
Can you help please?
Here is the code that I’m using:

$item_ttlprice = $_POST[$ttl_price];
This should at the very least be:
$item_ttlprice = $_POST[ttl_price];  // remove the last dolalr sign
Also, if youre HTML form's action is GET then you should replace POST with 
GET...



?>


Your price is: $



pretty simple I would think but I can’t figure out what I’m doing wrong.
The above is the new script.  Below is the script that the $ttl_price is
coming from:
td align=center>\$ $item_price 
   $item_qty 
   \$ $total_price
   remove
   ";
$ttl_price = $ttl_price + $total_price;
Can anyone tell me what I’m doing wrong?
I have tried changing this part:

$item_ttlprice = $_POST[$ttl_price];
?>
to $item_ttlprice = $_GET[ttl_price];
to $item_ttlprice = $_POST[‘$ttl_price’];
nothing seems to work.
Thanks for your help
-Rich
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Need some help

2005-05-11 Thread Mark Cain
run the following line of code in your page.  This will help you not only
with this experience but for a long time to come in the future:

phpinfo();

BTW, I suspect that your problem is that the variable is

$_POST['ttl_price'];

and not

$_POST[$ttl_price];

You will see that in the output of phpinfo();

Mark Cain


- Original Message -
From: "ReClMaples" <[EMAIL PROTECTED]>
To: "PHP" 
Sent: Wednesday, May 11, 2005 3:14 PM
Subject: [PHP-DB] Need some help


> Hello all,
>
>I am having an issue with displaying a variable from another php
script.
> Can you help please?
>
> Here is the code that I'm using:
>
> 
> $item_ttlprice = $_POST[$ttl_price];
> ?>
> 
> 
> Your price is: $
>  echo $item_ttlprice;
> ?>
> 
> 
>
> pretty simple I would think but I can't figure out what I'm doing wrong.
> The above is the new script.  Below is the script that the $ttl_price is
> coming from:
>
> td align=center>\$ $item_price 
> $item_qty 
> \$ $total_price
>  href=\"removefromcart.php?id=$id\">remove
> ";
> $ttl_price = $ttl_price + $total_price;
>
>
> Can anyone tell me what I'm doing wrong?
>
> I have tried changing this part:
>
> 
> $item_ttlprice = $_POST[$ttl_price];
> ?>
>
> to $item_ttlprice = $_GET[ttl_price];
>
> to $item_ttlprice = $_POST['$ttl_price'];
>
> nothing seems to work.
>
>
> Thanks for your help
> -Rich
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some HELP (not works)

2004-05-10 Thread Marcjon Louwersheimer



- Original message -
From: "Adam Farid" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Mon, 10 May 2004 19:54:51 +
Subject: [PHP-DB] Need some HELP (not works)

Thanks pepole.

I've tried but still does not work.

when I put the varaibles name between ' '

I found this error:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or 
`T_NUM_STRING'.

I typed in this way

 print ""; 

but nothing  a new.

I have checked  "register_globals" is on.
in my first page I used session_start(); and   global $HTTP_SESSION_VARS;
I dont know if this cause the problem that I had.

Thanks again and more help please.
Adam

_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Try using  print ""; 

Actually, if you're using 4.0.x, you can't use $_POST[UserName]. It was
implemented in 4.1.0.
http://ca.php.net/manual/en/reserved.variables.php#reserved.variables.post
Read about it here.
-- 
  Marcjon

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some HELP (not works)

2004-05-10 Thread jeffrey_n_Dyke



>Thanks pepole.

>I've tried but still does not work.

>when I put the varaibles name between ' '

>I found this error:
>Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
>`T_NUM_STRING'.

>I typed in this way

> print "VALUE='$_POST[UserName]'>"; 

This is pre register_global concerns...
try ..
print ";
or
print ";
for a little better HTML.

HTH
Jeff

_
Use MSN Messenger to send music and pics to your friends
http://www.msn.co.uk/messenger

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some HELP (not works)

2004-05-10 Thread Daniel Clark
Is it User_name or UserName?

Also try this string with 'UserName' in single quotes.

print ""; 

> I've tried but still does not work.
> when I put the varaibles name between ' '
>
> I found this error:
> Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
> `T_NUM_STRING'.
>
> I typed in this way
>
>  print " VALUE='$_POST[UserName]'>"; 
>
> but nothing  a new.
>
> I have checked  "register_globals" is on.
> in my first page I used session_start(); and   global $HTTP_SESSION_VARS;
> I dont know if this cause the problem that I had.
>
> Thanks again and more help please.
> Adam

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some HELP

2004-05-10 Thread Daniel Clark
unless you have Globals turned on, I think you and
$_POST['variable_name_here'] in the second page.


print "\n";


> Hi,
>
> I am  a new to php. I am using php ver 4.0.3 and MySQL.
>
> I have wrote two files and I'd like to pass some varaibles from first file
> to use them in the second file.
> but  the values did not displayed in the second file(nothing print out).
> and
> also I want to pass them to anothr file ...  here is what I've wrote :
>
>  file1.php**
>  .
> $username="A";
> $user_num="123";
> $user_addres="User Address";
>
> print "";
>   print "";
> print " VALUE='$username'>\n";
> print " value='$user_num'>";
> print " value='$user_addres'>";
>   print "";
> print "";
> 
> ?>
>
> ** second file file2.php 
>  
> ?>
>
> 
> 
>
>   print "";
>  print "";
>  print "";
> ?>
>
> Name:
> User Number:  ?>
> Address:  ?>
> ...
> 
> 
> 
> ..
>
>
> Kind Regrads
> Adam
> I hope someone  can help me. Thanks
>
> _
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Need some HELP

2004-05-10 Thread Ryan Jameson (USA)
It looks like "register_globals" is off. You'll have to access the
variables in the post array on your second page:

 print "";

and so on... Try that first.

<>< Ryan

-Original Message-
From: Adam Farid [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 10, 2004 12:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need some HELP

Hi,

I am  a new to php. I am using php ver 4.0.3 and MySQL.

I have wrote two files and I'd like to pass some varaibles from first
file to use them in the second file.
but  the values did not displayed in the second file(nothing print out).
and also I want to pass them to anothr file ...  here is what I've wrote
:

 file1.php**
";
print "";
print "\n";
print "";
print "";
print "";
print "";

?>

** second file file2.php 


 

";
 print "";
 print ""; ?>

Name:
User Number: 
Address:  ...



..


Kind Regrads
Adam
I hope someone  can help me. Thanks

_
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some help please!

2004-02-20 Thread JeRRy
Mikael,

Hi :)

> First of all it's never a good idea to use  instead of  anyway. Your loss. ;)

My loss?  Explain?  (all ears)  I've used only  ...  But I normally use
only  and have *never* had a problem with it.
 

But I am all ears knowing why though?  I have seen
alot of different ones but have no idea what they mean
to be totally honest, here are some.

Starting codes:

 You will need to do a refresh of the page to be able
> to run an insert  
> query.
> The refresh will need to be made by the JavaScript
> and since I've  
> refused to learn JavaScript, I can't help you with
> that. Remember also  
> that the JS needs to send a variable containing the
> username to the PHP  
> code.

Bugger, can anyone else assist me here, the query part
I know how to do.  Just need help refreshing maybe to
the same file but use a if extension like this:

samefile.php?winner=WINNER CODE GOES HERE

WINNER CODE I could generate automatically when a game
is done, so if a winner it will update to the db with
the winner code and where someone hits the above page
it will look for that code again, if can't find it
will not generate the credits.  If it's found it will.

> Now, I haven't had enough coffee today, so this is
> the best I can give  
> you:

I've had none . :P  (yet!)

> Also, you might want to parse the username through a
> few str_replace's  
> before you insert.. removing stuff like '<' and '>'.

Actually I grab the username from a session in the
setup.php file. :)  So I can grab it quite easily.

> Good luck!

Thanks. :)

> PS: I apparently sent this the first time using the
> wrong FROM  
> address.. So here it comes again. ;)

Your not alone, happened to me also. ;)

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need some help please!

2004-02-20 Thread Mikael Grön
Hi.

First of all it's never a good idea to use 

You will need to do a refresh of the page to be able to run an insert  
query.
The refresh will need to be made by the JavaScript and since I've  
refused to learn JavaScript, I can't help you with that. Remember also  
that the JS needs to send a variable containing the username to the PHP  
code.

Now, I haven't had enough coffee today, so this is the best I can give  
you:

	
		mysql_connect($hostname,$mysqluser,$mysqlpassword);
		$username = $_POST['user']; // What ever your JS will send the  
variable in.
		mysql_query("insert into score (user,date) values ('" . $username .  
"','".date("Y-m-d")."'););
	?>


Also, you might want to parse the username through a few str_replace's  
before you insert.. removing stuff like '<' and '>'.

Good luck!

Mikael

PS: I apparently sent this the first time using the wrong FROM  
address.. So here it comes again. ;)



On Feb 20, 2004, at 03:16, JeRRy wrote:

Hi,

I have this code, comments below:








.general3 {background-color:#33;z-index:4}
.general2 {background-color:#55;z-index:3}
.general1 {background-color:#77;z-index:2}
.general0 {background-color:#99;z-index:1}
  




mysql_connect($hostname,$mysqluser,$mysqlpassword);
$query = "select * from kras_params;";
$result = mysql_db_query($database,$query);
$row = mysql_fetch_array($result);
//fill vars
$total = $row[kr_total];
$chance = $row[kr_chance];
$maxwins = $row[kr_max_wins];
$wins = $row[kr_wins];
$timesaday = $row[kr_timesaday];
$host = $REMOTE_ADDR;
$check = 1;
$q_checktimes = "select count(*) from kras_users where
usr_ip='$host' and usr_date=CURDATE();";
$checktimes_result =
mysql_db_query($database,$q_checktimes);
$times = mysql_fetch_row($checktimes_result);
$error = "";
if ($times[0] < $timesaday) {
//poging toevoegen in database
$raisetimes = "insert into kras_users
values('$host',CURDATE(),'$HTTP_SESSION_VARS[username]');";
$raiseresult = mysql_db_query($database,$raisetimes)
or die('error: raise times failed');
} else {
$error .= "$txt_maxplay $timesaday.";
$check = 0;
}
if ($wins == $maxwins) {
$error = "$txt_maxwon";
$check = 0;
}
if ($check) {
//aantal malen dat spel gespeeld is ophogen met 1
$raisetotal = "update kras_params set
kr_total=(kr_total+1);";
$raiseresult = mysql_db_query($database,$raisetotal);

if ($total%$chance == 0) {
$raisewins = "update kras_params set
kr_wins=(kr_wins+1);";
$raisewinsresult =
mysql_db_query($database,$raisewins) or die('error:
raise wins failed');
$winner = 1;
}

?>
	
sc=new
Array('gfx/crown.jpg','gfx/x.jpg','gfx/seven.jpg','gfx/ diamond.jpg','gfx/ruby.jpg','gfx/magic.jpg');
z=new Array();

function check() {
var oDivs = document.all.tags("DIV");
for (i=0; i
var scratched = "true";
if (oDivs(i).style.display != "none" &&
oDivs(i).scratchable == "true") {
scratched = "false";
return false;
}
}
if (scratched == "true") {


?>


}
}

function rnd() {
return Math.floor(Math.random()*sc.length);
}

if ($winner) {
echo "function scimgload() {";
echo "document.scratch1.src=sc[rnd()];";
echo "document.scratch2.src=document.scratch1.src;";
echo "document.scratch3.src=document.scratch1.src;";
echo "}";
} else {
echo "function scimgload() {";
echo "document.scratch1.src=sc[rnd()];";
echo "document.scratch2.src=sc[rnd()];";
echo "document.scratch3.src=sc[rnd()];";
echo "while (document.scratch2.src ==
document.scratch3.src) {";
echo "document.scratch3.src=sc[rnd()];";
echo "}";
echo "}";
}
?>
function scmetal() {
for (i=0;i<192;i++)
document.all['M'+i].style.display="";
}

scimgload();
TMC Scratch n Match
// This script must be within the relatively
positioned DIV.
for (p=0;p<3;p++)
for (i=0;i<4;i++)
for (j=0;j<4;j++)
for (k=0;k<4;k++) {
idn=p*64+i*16+j*4+k;
document.write('
onmouseover="style.display=\'none\';check();"
CLASS="general'+i+'"
STYLE="position:absolute;width:25;height:25;top:'+eval(0+j*25)+'; left:'+eval(125+p*125+k*25)+'">
');
}
STYLE="position:absolute;top:0;left:125;width:100;height:100;z-index: 0"> STYLE="position:absolute;top:0;left:250;width:100;height:100;z-index: 0"> STYLE="position:absolute;top:0;left:375;width:100;height:100;z-index: 0"> STYLE="position:absolute;top

Re: [PHP-DB] need some help...


Awesome, thanks a ton!

Thanks!

-Alex "Big Al" Behrens
E-mail: [EMAIL PROTECTED]
Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
[EMAIL PROTECTED]
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 7:00 PM
Subject: Re: [PHP-DB] need some help...


> Not really a database question, but why not...
>
> Step 1:  Clean up the code...
>  a)  Convert all double-quote to single quotes in the HTML
portion.
>   I usually use doubles for PHP and singles for HTML.  I hate
>   having to escape quotes.
>  b)  Use of spacing and indentation.
>
> old
> **
>   
> 
>   
> 
>src="/images/menu-reviews.gif" width="137" height="20"> $db = mysql_connect( "db",  "**",  "**");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r)) {
> printf (" border=\"0\">  - 
href=\"%s\">%s",$a["url"],$a["picurl"],$a["picurl"],$a["title"])
> ;
> }
> ?>
> 
> 
>   
> 
>   
> **
>
>
>
> new
> **
>   
> 
>   
> 
>   
>   
>  $db = mysql_connect( "'db",  "**",  "**");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r))
> {
>   printf ("   border='0'>  -
>   %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"]);
> }
> ?>
> 
> 
>   
> 
>   
> **
>
> Since you have to put a string value, assign all output to a single string
called $output.
> Note that I moved your printf() to an echo, and simplified your output
string by preassigning
> variables.  An extra step, but greatly enhances readability and
maintenance...
> Also remember that the ".=" is an append operator whereas "=" is
assignment.
>
> even newer
> **
>  // Assign the stuff before...
>  $output =
> "
>   
> 
>   
> 
>   
>   
>  ";
>  $db = mysql_connect( "'db",  "**",  "**");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r))
> {
>   $url = $a["url"];
>   $picurl = $a["picurl"];
>   $title = $a["title"];
>
>   // add in each link to the review
>   $output .= "
>   
>  
>   
>     -
>   
>   $title
>   
>   ";
> }
> ?>
>   // finish the structure HTML
>   $output .= "
> 
> 
>   
> 
>   
> ";
>
> // Now fopen() the file, fputs the $output, and fclose() the file.
> **
> http://www.php.net/manual/en/function.fopen.php
> http://www.php.net/manual/en/function.fputs.php
> http://www.php.net/manual/en/function.fclose.php
>
> Party on!
>
> -Szii
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] need some help...


If you want your output to validate xhtml, you had better make sure that
your html looks like:

Link

and NOT:

Link



> -Original Message-
> From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 4:52 PM
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: RE: [PHP-DB] need some help...
> 
> 
> Thank you. Someone else exists who has the sense of mind to use single
> quotes. I hate looking at other people's code that has tons 
> of \"s in it.
> 
> - Jonathan
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 5:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] need some help...
> 
> 
> Not really a database question, but why not...
> 
> Step 1:  Clean up the code...
>  a)  Convert all double-quote to single quotes in the 
> HTML portion.
>   I usually use doubles for PHP and singles for 
> HTML.  I hate 
>   having to escape quotes.
>  b)  Use of spacing and indentation.
> 
> old
> **
>   
> 
>   
> 
>size="1"> src="/images/menu-reviews.gif" width="137" height="20"> $db = mysql_connect( "db",  "**",  "**");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC 
> LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r)) {
> printf (" border=\"0\">  -  href=\"%s\">%s",$a["url"],$a["picurl"],$a["picurl"
> ],$a["title"])
> ;
> }
> ?>
> 
> 
>   
> 
>   
> **
> 
> 
> 
> new
> **
>   
> 
>   
> 
>   
>height='20'>
>  $db = mysql_connect( "'db",  "**",  "**");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC 
> LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r))
> {
>   printf ("   border='0'>  - 
>href='%s'>%s",$a["url"],$a["picurl"],$a["picurl"],
> $a["title"]);
> }
> ?>
> 
> 
>   
> 
>   
> **
> 
> Since you have to put a string value, assign all output to a 
> single string
> called $output.
> Note that I moved your printf() to an echo, and simplified your output
> string by preassigning
> variables.  An extra step, but greatly enhances readability and
> maintenance...
> Also remember that the ".=" is an append operator whereas "=" 
> is assignment.
> 
> even newer
> **
>  // Assign the stuff before...
>  $output =
> "
>   
> 
>   
> 
>   
>height='20'>
>  ";
>  $db = mysql_connect( "'db",  "**",  "**");
> mysql_select_db( "net3dual_reviews",$db);
> $r = mysql_query("SELECT * FROM hwureviews ORDER BY num DESC 
> LIMIT 7");
> $max = mysql_query("select max(num) from hwureviews",$db);
> while($a=mysql_fetch_array($r))
> {
>   $url = $a["url"];
>   $picurl = $a["picurl"];
>   $title = $a["title"];
> 
>   // add in each link to the review
>   $output .= "
>   
>  
>   
>     - 
>   
>   $title
>   
>   ";
> }
> ?>
>   // finish the structure HTML
>   $output .= "
> 
> 
>   
> 
>   
> ";
> 
> // Now fopen() the file, fputs the $output, and fclose() the file.
> **
> http://www.php.net/manual/en/function.fopen.php
> http://www.php.net/manual/en/function.fputs.php
> http://www.php.net/manual/en/function.fclose.php
> 
> Party on!
> 
> -Szii
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] need some help...


Thank you. Someone else exists who has the sense of mind to use single
quotes. I hate looking at other people's code that has tons of \"s in it.

- Jonathan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 5:00 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] need some help...


Not really a database question, but why not...

Step 1:  Clean up the code...
 a)  Convert all double-quote to single quotes in the HTML portion.
  I usually use doubles for PHP and singles for HTML.  I hate 
  having to escape quotes.
 b)  Use of spacing and indentation.

old
**
  

  

    - %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"])
;
}
?>


  

  
**



new
**
  

  

  
  
  - 
  %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"]);
}
?>


  

  
**

Since you have to put a string value, assign all output to a single string
called $output.
Note that I moved your printf() to an echo, and simplified your output
string by preassigning
variables.  An extra step, but greatly enhances readability and
maintenance...
Also remember that the ".=" is an append operator whereas "=" is assignment.

even newer
**
 // Assign the stuff before...
 $output =
"
  

  

  
  
 ";

 
  
    - 
  
  $title
  
  ";
}
?>
  // finish the structure HTML
  $output .= "


  

  
";

// Now fopen() the file, fputs the $output, and fclose() the file.
**
http://www.php.net/manual/en/function.fopen.php
http://www.php.net/manual/en/function.fputs.php
http://www.php.net/manual/en/function.fclose.php

Party on!

-Szii


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] need some help...


Not really a database question, but why not...

Step 1:  Clean up the code...
 a)  Convert all double-quote to single quotes in the HTML portion.
  I usually use doubles for PHP and singles for HTML.  I hate 
  having to escape quotes.
 b)  Use of spacing and indentation.

old
**
  

  

    - %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"])
;
}
?>


  

  
**



new
**
  

  

  
  
  - 
  %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"]);
}
?>


  

  
**

Since you have to put a string value, assign all output to a single string called 
$output.
Note that I moved your printf() to an echo, and simplified your output string by 
preassigning
variables.  An extra step, but greatly enhances readability and maintenance...
Also remember that the ".=" is an append operator whereas "=" is assignment.

even newer
**
 // Assign the stuff before...
 $output =
"
  

  

  
  
 ";

 
  
    - 
  
  $title
  
  ";
}
?>
  // finish the structure HTML
  $output .= "


  

  
";

// Now fopen() the file, fputs the $output, and fclose() the file.
**
http://www.php.net/manual/en/function.fopen.php
http://www.php.net/manual/en/function.fputs.php
http://www.php.net/manual/en/function.fclose.php

Party on!

-Szii


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php