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?  :-\

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.