Jump to content

my_r31_baby

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

my_r31_baby's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Slotted that little baby in and still getting the same result...  ??? Any other ideas?  ;) Here is the full script: (might be easier putting into your own editor) <?php include("../db_connect.php"); include("functions.php"); session_start(); $u_pk = $_SESSION['u_pk']; if (!session_is_registered('u_pk')) { // Redirect to login page header('Location: ../index.php'); exit; } else { // Load page $num_problems = 1; $sql = "SELECT * FROM odc_genre " ; $result_genre = mysql_query( $sql ) or die ( 'Unable to execute query.' ); $num_genre = mysql_num_rows( $result_genre ); //echo $num_genre."<br>"; while ($row = mysql_fetch_assoc($result_genre)) {  $gid = $row['odc_gen_id']; $gname = $row['odc_gen_genname']; ?> <option><?=$gname;?></option><br> <? } $sql = "SELECT * FROM online_dvd_users WHERE odvdu_id = '$u_pk' " ; $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); $num = mysql_num_rows( $result ); while ($row = mysql_fetch_assoc($result_genre)) {  $fname = $row['odvdu_firstname']; $lname = $row['odvdu_lastname']; }; if($_POST['submitted']=="true") { if($_POST['title']=="") {   $error = "Title is missing";   $num_problems = 1; echo $error."<br>"; } if($_POST['rating']=="") {   $error = "Rating is missing";   $num_problems = 1; echo $error."<br>"; } if($_POST['genre']=="") {   $error = "Genre is missing";   $num_problems = 1; echo $error."<br>"; } if ($num_problems == 0){ //Tests if a username already exists $sql = "SELECT * FROM online_dvd_users WHERE odvdu_username = '$username' " ; $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ) ; $num = mysql_num_rows( $result ); if ($num != 0){ $num_problems = 1; echo $uname ?> already exists. Please try another username... <? } } } ?> <!-- ------------------------------------ html starts here ----------------------------------------- --> <head> <link href="../css/style.css" rel="stylesheet" type="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#6633FF"> <hr> <div align="center"><h2>Add a new DVD</h2><br> <strong>All <font color="#FF0000">*</font> items are mandatory.</strong><br>   <form name="form1" method="post" action="dvd_add.php">     <table> <tr> <td><div align="right">Local Ref #:</div></td> <td><div align="left"><input type="text" name="local_ref"></div></td> </tr> <tr> <td><div align="right">Title:</div></td> <td><div align="left"><input type="text" name="title"></div></td> <td><font color="#FF0000">*</font></td> </tr> <tr> <td><div align="right">Rating:</div></td> <td><div align="left"> <select name="rating"> <option value="<?=$_POST['rating']?>"><?=$_POST['rating']?></option>                   <option value="G">G</option>             <option value="PG">PG</option>             <option value="M">M</option>             <option value="M15+">M15+</option>             <option value="MA">MA</option>             <option value="MA15+">M15+</option>             <option value="R18+">R18+</option>             <option value="X">X</option>           </select>           </div></td> <td><font color="#FF0000">*</font></td> </tr> <tr> <td><div align="right">Genre:</div></td> <td><div align="left"> <select name="genre">   <option value="<? echo $_POST['genre']; ?>"><? echo $_POST['genre']; ?></option>                <?   while ($row = mysql_fetch_assoc($result_genre)) { echo '<option value="' . $row['odc_gen_id'] . '">' . $row['odc_gen_genname'] . '</option>'; }   ?> </select>           </div></td> <td><font color="#FF0000">*</font></td> </tr> <tr> <td><div align="right">Comments:</div></td> <td><div align="left"><input type="textbox" name="comments"></div></td> </tr> <tr> <td><div align="right">DVD Cover File:</div></td> <td><div align="left"><input type="text" name="file"></div></td> </tr> </table>     <p>       <input type="submit" name="reset" value="Reset">       <input type="submit" name="submit" value="Submit">       <input type="hidden" name="submitted" value="true">     </p>   </form> </div> </body> <? } ?>
  2. This code works: $sql = "SELECT * FROM odc_genre " ; $result_genre = mysql_query( $sql ) or die ( 'Unable to execute query.' ); $num_genre = mysql_num_rows( $result_genre ); //echo $num_genre."<br>"; while ($row = mysql_fetch_assoc($result_genre)) {  $gid = $row['odc_gen_id']; $gname = $row['odc_gen_genname']; ?> <option><?=$gname;?></option><br> <? } RESULT Kids Family Comedy Romantic-Comedy Comedy Action Sci-Fi Drama Thriller Horror Western Here is my problem code: <select name="genre">   <option value="<?=$_POST['genre']?>">,<?=$_POST['genre']?></option>         <?   while ($row = mysql_fetch_assoc($result_genre)) {      $gid = $row['odc_gen_id'];     $gname = $row['odc_gen_genname'];   ?>   <option value="<?php echo $gid ; ?>"><?php echo $gname ; ?></option>   <?   }; ?> ANY Ideas??? The select box i get has nothing in it???
  3. GOT IT.. All good gents... NOthing a few spaces couldn't fix
  4. The $id in the query below is my problem. if i change it to a ID number in the database IE hard code it it works fine. Any sugestions?? $query = "SELECT * FROM personal_phonebooks WHERE ppb_id='$id'";
  5. I'm getting blank pages back. I cant find the php syntax error... Help please... <?php include("../db.php"); session_start(); $u_pk = $_SESSION['u_pk']; $id = $_GET['id']; if (!session_is_registered('u_pk')) { // Redirect to login page echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL='../index.php'>"; } else { $query = "SELECT * FROM personal_phonebooks WHERE ppb_owner='4' AND ppb_category='3'"; $result = mysql_query($query); $num = mysql_num_rows($result); ?> <body bgcolor="#FFFFCC"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../css/pee_yellow.css" rel="stylesheet" type="text/css"> </head> <table width="100%" border="1" bgcolor="#FFFFFF">   <tr bgcolor='#66CCFF'>     <td><strong>First Name</strong></td>     <td><strong>Lastname</strong></td>     <td><strong>Home Phone</strong></td>     <td><strong>Email Address</strong></td>   </tr> <? while ($row = mysql_fetch_assoc($result)) { $id = $row['ppb_id']; $fname = $row['ppb_firstname']; $lname = $row['ppb_lastname']; $emailaddress = $row['ppb_emailaddress']; $homephone = $row['ppb_homephone']; ?>   <tr>     <td>id</a></td>     <td>lname</td>     <td>homephone</td>     <td>emailaddress</td>   </tr> <? }; ?> </table> </body> <? mysql_free_result($result);    # Free's mysql echo "<br>"; echo "<br>"; echo "$num records found..."; ?> <p align="center"><a href="search.php" target="_self">New Search</a></p> </html>
  6. Solved... Using the $variables is the G O... <?php include("db_connect.php"); include("main/functions.php"); //Start Authentication process $auth = false; // Assume user is not authenticated $uname = $_POST['username']; //convert all the posts to variables: $pword = $_POST['password']; //convert all the posts to variables: $pword = md5($pword); // Hashes password as is in DB // THIS IS NOT WORKING if (isset( $uname ) && isset($pword)) { // Starts testing if uname and pword match in DB $sql = "SELECT * FROM pb_users WHERE odvdu_username = '$uname' AND odvdu_password = '$pword'"; // Build query for processing $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); // Execute the query and put results in $result $num = mysql_num_rows( $result ); // Get number of rows in $result. // Get number of rows in $result. // while ($row = mysql_fetch_assoc($result)) {  // $u_pk = $row['odvdu_id']; // $fname = $row['odvdu_firstname']; // $lname = $row['odvdu_lastname']; // }; // if ( $num != 0 ) { // $auth = true; // A matching row was found - the user is authenticated. // }; }; ?> <!-- ------------------------------------ html starts here ----------------------------------------- --> <head> <link href="./css/style.css" rel="stylesheet" type="text/css"> </head> <body> <div align="center">   <p><br>     <br>     <br>     <h1>Online<br>DVD Collections</h1>   <form name="form1" method="post" action="index.php">     <p>Username:       <input type="username" name="username">       <br>       Password:       <input type="password" name="password">     </p>     <p>       <input type="reset" name="reset" value="Reset">       <input type="submit" name="submit" value="Submit">     </p>   </form> </div> </body>
  7. I have written    "// THIS IS NOT WORKING"    in the script below and im having issues with the if statement under that. Any help would be great... Cheers Brendan <?php include("db_connect.php"); include("main/functions.php"); //Start Authentication process $auth = false; // Assume user is not authenticated $uname = $_POST['username']; //convert all the posts to variables: $pword = $_POST['password']; //convert all the posts to variables: $pword = md5($pword); // Hashes password as is in DB // THIS IS NOT WORKING if (isset( $_POST['username'] ) && isset( $_POST['password'] )) { // Starts testing if uname and pword match in DB $sql = "SELECT * FROM online_dvd_users WHERE odvdu_username = $_POST['username'] AND odvdu_password = $_POST['password']"; // Build query for processing $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); // Execute the query and put results in $result $num = mysql_num_rows( $result ); // Get number of rows in $result. // while ($row = mysql_fetch_assoc($result)) {  // $u_pk = $row['odvdu_id']; // $fname = $row['odvdu_firstname']; // $lname = $row['odvdu_lastname']; // }; // if ( $num != 0 ) { // $auth = true; // A matching row was found - the user is authenticated. // }; }; ?> <!-- ------------------------------------ html starts here ----------------------------------------- --> <head> <link href="./css/style.css" rel="stylesheet" type="text/css"> </head> <body> <div align="center">   <p><br>     <br>     <br>     <h1>Online<br>DVD Collections</h1>   <form name="form1" method="post" action="index.php">     <p>Username:       <input type="username" name="username">       <br>       Password:       <input type="password" name="password">     </p>     <p>       <input type="reset" name="reset" value="Reset">       <input type="submit" name="submit" value="Submit">     </p>   </form> </div> </body>
  8. <td><input type="text" name="username" value= "<?php=$_POST['username']?>" size="40%"></td> Everytime i load the page as soon as i enter the php code i get blank pages... Any ideas?
  9. I originally thought it was the database it was having trouble getting it from so that why i am trying to go from _ to " "... Here is my script: <?php include("../db.php"); session_start(); $u_pk = $_SESSION['u_pk']; $sql = "SELECT * FROM pb_users WHERE pb_users_userid = '$u_pk' " ; // echo $sql; $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); $num = mysql_num_rows( $result ); while ($row = mysql_fetch_assoc($result)) {  $fname = $row['pb_users_firstname']; $lname = $row['pb_users_lastname']; $homeaddress = $row['pb_users_homeaddress']; $townsub = $row['pb_users_townsub']; $state = $row['pb_users_state']; $postcode = $row['pb_users_postcode']; $emailaddress = $row['pb_users_emailaddress']; $homephone = $row['pb_users_homephone']; $mobilephone = $row['pb_users_mobilephone']; $homeaddress2 = eregi_replace("_", " ", $homeaddress); }; ?> <tr>         <td>First Name: <font color="#FF0000">*</font></td>         <td><input type="text" name="first" value= <?php echo $fname ; ?> size="40%"></td>       </tr>   <tr>         <td>Last Name: <font color="#FF0000">*</font></td>         <td><input type="text" name="last" value= <?php echo $lname ; ?> size="40%"></td>       </tr>     <tr>         <td>Address: <font color="#FF0000">*</font></td>         <td><input type="text" name="address" value= <?php echo "$homeaddress2" ; ?> size="40%"></td>       </tr>     <tr>         <td>Town/Suburb<font color="#FF0000">*</font></td>         <td><input type="text" name="townsuburb" value= <?php echo $townsub ; ?> size="40%"></td>       </tr>
  10. just got it... Thanks guys...  ;D <?php while ($row = mysql_fetch_assoc($result)) {    $id = $row['pb_users_userid']; $fname = $row['pb_users_firstname']; $lname = $row['pb_users_lastname']; $emailaddress = $row['pb_users_emailaddress']; $homephone = $row['pb_users_homephone']; echo "<td><a href='display_upk_details.php?id=$id'>$fname</a></td>"; echo "<td>$lname</td>"; echo "<td>$homephone</td>"; echo "<td>$emailaddress</td>"; echo "</tr>"; }; ?> <?php $id = $_GET['id']; echo " your ID is: $id"; ?>
  11. thanks guys... My apologies in advance this looks like a dogs breakfast... <?php include("../db.php");    # Connects to DB $searchvariable = $_POST['search']; // LIKE 'Wr*' $query = "SELECT * FROM pb_users WHERE (((pb_users_firstname)LIKE'%$searchvariable%')OR((pb_users_lastname)LIKE'%$searchvariable%')OR((pb_users_homephone)LIKE'%$searchvariable%')OR((pb_users_state)LIKE'%$searchvariable%')OR((pb_users_postcode)LIKE'%$searchvariable%')OR((pb_users_mobilephone)LIKE'%$searchvariable%')OR((pb_users_homeaddress)LIKE'%$searchvariable%')OR((pb_users_emailaddress)LIKE'%$searchvariable%')OR((pb_users_townsub)LIKE'%$searchvariable%')OR((pb_users_website)LIKE'%$searchvariable%'))"; $result = mysql_query($query); $num = mysql_num_rows( $result ); ?> <?php while ($row = mysql_fetch_assoc($result)) {    $fname = $row['pb_users_firstname']; $lname = $row['pb_users_lastname']; $emailaddress = $row['pb_users_emailaddress']; $homephone = $row['pb_users_homephone']; echo "  <tr>"; echo "<td><a href='display_upk_details.php' target='_self'> $fname </a> </td>"; echo "<td>$lname</td>"; echo "<td>$homephone</td>"; echo "<td>$emailaddress</td>"; echo "</tr>"; }; ?>
  12. Little background I = newbie i have sessions working ok so i have my session u_pk ready to go I am setting up an online phonebook and when i do a search i get several results. The problem is that not all the info fits on screen so am only displaying <firstname> <lastname> <homephone> <email>. I want to have a link on the name or something so it can be clicked on and bring up that persons full details. Any ideas how this is done?
×
×
  • 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.