Page 2 of 2

Posted: Sun Jan 18, 2004 11:29 am
by pinehead18
well i've probably changed it 90 times. LOL
But lets see what i got atm.

I have what you have atm. It actually prints explode( and it dones't actually perform the function. I was trying to figure out why but kept getting parse errors. Seems my extreme newbyness is catching up to me :(

$sql = "SELECT * FROM users where user='$name'";
$result = mysql_query($sql) or die(mysql_error());

while($arr = mysql_fetch_array($result))
{
$pics[] = $arr["add_picts"];
}
foreach($pics as $picid)
{
echo 'Print HTML for '.join('<br />', explode(',', $picid)).'<br />";

}

Thanks so much for your help

Code: Select all

<?php

?>

Code: Select all

<?php

?>

Posted: Sun Jan 18, 2004 11:31 am
by markl999
.'<br />";
^^ should be
.'<br />';

Posted: Sun Jan 18, 2004 11:33 am
by pinehead18
yay thanks!!! I'm sure i'll have tons more questions :). I wish people would post how to connect to sql and stuff on here so i can give back the help i recieved lol

Posted: Sun Jan 18, 2004 11:37 am
by pinehead18
Ok didn't take me long to come back.

I need to make it so echo 'Print HTML for '.join('<br />', explode(',', $picid)).'<br />";

turns into $table .= 'Print HTML for '.join('<br />', explode(',', $picid)).'<br />';


However, parse error city after you help me on this LOL do you know of an article that talks about all the ' ". "'; i need to use?

Posted: Sun Jan 18, 2004 11:53 am
by markl999
Hmm..i don't see a parse error there :o

The rules on quotes etc are pretty simple but can seem complicated as there's many ways to mix/match them .. and i don't know of any docs (apart from the manual) that goes into details about all the possibilities.

In general you ....
use single quotes for echoing strings (with no vars), like echo 'foo bar';
use double quotes if there's vars in there, like echo "foo $bar";

Usually the biggest trap is doing echo 'foo $bar'; which won't do as you expect, variables arn't 'interpolated' inside single quotes, which just means you see $bar instead of $bar's value :o
</bad explanation>

Posted: Sun Jan 18, 2004 11:57 am
by dull1554
what do you mean, you want the first line to turn into the second line????
i think your talking about concatanation ya know

Code: Select all

$name=pinehead18;
echo "your name is".$name.".";
//you can do the same thing in a $var

$var = "your name is".$name.".";
catch my drift?

may the force be with you!!!!

Posted: Sun Jan 18, 2004 12:22 pm
by pinehead18
No, my template system is kinda weird. I put all the contents of the html page in $output

So i need to make $table = "the for each loop with my html" and put it in my $output statement.

Posted: Sun Jan 18, 2004 12:25 pm
by dull1554
huh, i'm really confused..........i should have slept last night.....DAMN addictive PHP

Posted: Sun Jan 18, 2004 12:37 pm
by pinehead18
haha you got that right. Addictive. It wouldn't be so bad if i could learn it quicker :(

Posted: Sun Jan 18, 2004 12:38 pm
by pinehead18
basically i need to take
echo 'Print HTML for '.join('<br />', explode(',', $picid)).'<br />';

and turn it into $table . = "Print HTML for '.join('<br />', explode(',', $picid)).'<br />';

without a city of parse errors

Posted: Sun Jan 18, 2004 9:41 pm
by DuFF

Code: Select all

<?php
$table .= "Print HTML for " . join('<br />', explode(',', $picid)) . "<br />";
?>
Does that work?

Posted: Sun Jan 18, 2004 10:29 pm
by pinehead18
yes, thank you i'm in good shape now.

thank you all for your help

I think i figured alot out today about arrays

Been a long day :(