Jump to content

New line in scripts + another simple question.


Hangwire

Recommended Posts

Hi all, I have a question. How do I put a new line in a script? I've tried everything.

<?php
$con = mysql_connect("localhost","*","*");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$sql="SELECT * FROM People
WHERE FirstName='Borko'
AND LastName='Borkov'"; 

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Found!";

echo($sql); 

mysql_close($con)
?>  

 

I wrapped it in <html> and so on, <br /> doesn't work. Saved it in html, <br /> still doesn't work and the script doesn't execute.

 

The output I get right now is

 

Found!SELECT * FROM People WHERE FirstName='Borko' AND LastName='Borkov'

 

I want it to display

 

Found!

SELECT * FROM People WHERE FirstName='Borko' AND LastName='Borkov'

 

And another question - how can I see what the sql variable is searching for from the browser? For now, as you have seen, I just use the echo($sql) but it doesn't quite cut it - is there a way to see just FirstName and LastName without the whole code? I tried echo($sql [FirstName] [LastName], as you've already guessed it didn't work... A hint would also be greatly appreciated!

 

Any help on these two issues?  :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.