Jump to content

smiles

Members
  • Posts

    774
  • Joined

  • Last visited

Posts posted by smiles

  1. uhm ... could you tell me how to display the content in $result1

    while ($row = mysql_fetch_array($result1))  {  echo $row['Information'];  }// these above code not work ???

  2. In SQL we have this syntax, for i.e ...

    SELECT Information FROM Person WHERE Name = 'Peter'

    Is there anyway to change 'Peter' to an variable which I get from a formlike this

    $result = %_POST['Some_Name_Here'];$result1 = mysql_query("SELECT Information FROM Person WHERE Name = $result ") ;//// these above code not work

    thanks !

  3. Ok, I've another question. If I will be hacked, from where I can see where is the bug, later?
    Mostly, they will change your index pageor worse, they will delete all your file and database .
  4. I started using html about a month ago, yesterday i recomended a friend to the w3schools tutorials and after trying the first try it example his webbrowser(internet explorer) would not open the mypage.htm saved to his c:\. I had a look at the code and he wrote it properly, is there a setting in internet explorer to enable pages to be viewed of a harddrive??
    No.Unless you upload your file from hard drive to a web page, vice versa, you must use browser to open it :)
  5. Thanks! That command run well

    while($row = mysql_fetch_array($result2))   {  echo $row['Name']." ".$row['Infor'];  }

    Is there anyway to echo the first ( or 2nd,3rd) element of that array ???

  6. Well I understand but here is the new code and get that warningWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\giup1.php on line 6

    <?php include("giup.php"); $result1 = $_POST["theName"];echo $result1;$result2 = mysql_query("SELECT * FROM Person");while($row = mysql_fetch_array($result2)) // line 6 here  {  echo $row['Name']." ".$row['Infor'];  }?>

    my Person's database isName | Infora.......| boyb.......| girl

  7. Hi I have just had a problem, show in my code

    <?php include("giup.php"); $result1 = $_POST["theName"];echo $result1; // I see the result, for example 'a'$result2 = mysql_query("SELECT Infor FROM PersonWHERE Name='$result1' "); // Person with Name 'a' has the Info is 'boy'echo $result2; // now don't see the result 'boy'?>

    How can I make it run ? :)

  8. Just to try to create a database name my_database and create a table but ... database created, table isn't created ???

    <html><body><?php$connect = mysql_connect("localhost","root","");if (!$connect)	{	die('Could not connect:'.mysql_error());	}if (mysql_query("CREATE DATABASE my_database",$connect))	{	echo "Database created";	}else	{	echo "Error :".mysql_error();	};mysql_select_db("my_database", $connect);$sql = "CREATE TABLE Person(Name varchar(15),Infor  varchar(15),)";mysql_query($sql,$connect);// Suppose insert some infomysql_query("INSERT INTO Person (Name,Infor)	VALUE ('a','boy')");mysql_query("INSERT INTO Person (Name,Infor)	VALUE ('b','girl')");// We get//  ------------------//  |  Name  |  Infor  |//  |   a	  |  boy  |//  |   b	  |  girl   |//  ------------------//  a,b live in drop down list $result = mysql_query("SELECT Name FROM Person");echo "<form>";echo "<select name='theName'>";while ($theArray = mysql_fetch_array($result))	{	echo "<option value=' ".$theArray['Name']." '>".$theArray['Name']."</option>";	}echo "</select>";echo "</form>";?><hr/></body></html>

×
×
  • Create New...