New guy, used to asp - help appriciated...
Moderator: General Moderators
-
phil speakman
- Forum Newbie
- Posts: 12
- Joined: Wed Oct 22, 2003 9:25 am
- Location: Liverpool
so mucj info
cheers all, i'm working my way through the info at a slow pace to try and pick it up along the way
quick question, what does this mean, or at least what do the <<<'s mean
echo <<< TABLE
cheers Phil
quick question, what does this mean, or at least what do the <<<'s mean
echo <<< TABLE
cheers Phil
-
phil speakman
- Forum Newbie
- Posts: 12
- Joined: Wed Oct 22, 2003 9:25 am
- Location: Liverpool
eerrrmmmm
ok digin it
var = this <<<
[......]
this
sticks the whole line[...] into a string called var, am i right
if so what are the benefits - is it the wholw double quote single quote nightmare?
I await with baited breath
var = this <<<
[......]
this
sticks the whole line[...] into a string called var, am i right
if so what are the benefits - is it the wholw double quote single quote nightmare?
I await with baited breath
This is wrong!
This is right:
<<< should come first, and it is more advisible to use CAPS. Since this might happen sometimes:
So it'll get PHP confused, since it'll end on the first "this" it sees and "is a sentence" and "this" would cause an error.
-Nay
Code: Select all
var = this <<<
[......]
thisCode: Select all
var = <<< THIS
[......]
THISCode: Select all
var = <<< this
this is a sentence!
this-Nay
-
phil speakman
- Forum Newbie
- Posts: 12
- Joined: Wed Oct 22, 2003 9:25 am
- Location: Liverpool
cool
ok i understand
now i have ammended my code to be in line with yours and it is spitting out all values in database
as you can see, with LIKE
http://members.lycos.co.uk/philspeakman/send.asp
there is a pupil called sally johnson
and with WITH = it spits out none
hope i'm not doing your head in with all these questions.
now i have ammended my code to be in line with yours and it is spitting out all values in database
as you can see, with LIKE
http://members.lycos.co.uk/philspeakman/send.asp
there is a pupil called sally johnson
and with WITH = it spits out none
hope i'm not doing your head in with all these questions.
-
phil speakman
- Forum Newbie
- Posts: 12
- Joined: Wed Oct 22, 2003 9:25 am
- Location: Liverpool
like this
Code: Select all
<?php
// storing a connection in a variable @ chills any errors
$con = @mysql_connect("localhost","philspeakman","goatboy")or die(mysql_error()); ;
// storing a db selection
$db = @mysql_select_db("philspeakman_uk_db")or die(mysql_error());
echo('<p>Here is a list of the images and classes that produced them.</p>
<table>');
// storing search term in var from address bar
$search = "%" .$_POSTї'pupil']."%";
echo($search);
// query get all from table where pupil = search term
$qu = "SELECT * from alt_bridge_pupils WHERE pupil like '{$search}'";
// result of query stored in result variable
$result = @mysql_query($qu,$con) or die (mysql_error());
// while not eof fetch info from result store in row var
while($row = mysql_fetch_array($result)){
echo('<tr><td>'.$row ї'pupil'].'</td>');
}
?>
</table>Code: Select all
echo($search);and that ain't right.
Any thoughts?
Phil
I took out the @ so it does throw up an error. When you've got the script all working, then put back the @. Try this code:
-Nay
Code: Select all
<?php
$con = mysql_connect("localhost","philspeakman","goatboy")or die(mysql_error());
$db = mysql_select_db("philspeakman_uk_db")or die(mysql_error());
echo "<p>Here is a list of the images and classes that produced them.</p><table>";
$search = "%" .$_POST['pupil']."%";
echo $search;
$qu = "SELECT * from alt_bridge_pupils WHERE pupil like '{$search}'";
$result = mysql_query($qu,$con) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td>" . {$row['pupil']} . "</td>";
}
?>
</table>-
phil speakman
- Forum Newbie
- Posts: 12
- Joined: Wed Oct 22, 2003 9:25 am
- Location: Liverpool
errmmmm2
without the @
error in line 23 which is echo line of this
what do the . and the "%" 's mean?
error in line 23 which is echo line of this
Code: Select all
while($row = mysql_fetch_array($result)){
echo "<tr><td>" . {$rowї'pupil']} . "</td>"; }