Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. how do I make this form here have a limit on the value's name, then it moves to the next line? <form action=\"reply.php?com_id=$com_id\" method=\"post\"> <font color='brown'><u><input type=\"submit\" name ='submit' class=\"link\" value='$title'></u></font> </form>
  2. so basically I have 6 main rows, userid, eventid, event name, subevent names, and user's name and an id column(eventid, userid(unique)). I need to make it so that when I register a user for an event, the correct userid will post, not userid's starting after 12. The first name on the page is associated with userid 12, so that is where it is getting it from and it is not grabbing any other userids besides for that one................so If I were to select all users, I am sure it would work fine, but if I only select 2 users lets say userids of 1 and 2, then it posts it as userids of 12 and 13, not 1 and 2. I have attached some pics to show what it is doing. so in the picture, whether I select the last one or the middle one, the userid's do not correspond to person when they post. first box is userid, second is id.........every two boxes.............does this make sense? [attachment deleted by admin]
  3. there is not auto increment, primary key though is id, which is the userid,eventid (1,25 for ex.) 12 is the first userid that is returned from the array piece. I need to know how I can make it post the correct userid that is returned from the one piece, I have set fields to text and they show the correct userid for each person, but it is only posting the first persons userid that is in the members table, does that make sense?
  4. part of the issue could be that the person with 12 is the first result?
  5. ok, well basically, everytime I begin trying to put a new piece in, like lets say, I register 2 people the first time, then 3 the second, well the first time, it gives id's 12 and 13, then second time ids of 12,13, and 14. I need to know why it isn't assigning the actual person's id.
  6. ok, well now it is posting userid's of 12+........nothing below......why? <?php function escapeMysql($str) { if(get_magic_quotes_gpc()) : $str = stripslashes($str); endif; $str = mysql_real_escape_string($str); // Will help prevent mysql injection! return $str; } $myvar = escapeMysql($_GET['eventid']); $sql = mysql_query("SELECT * FROM Registration WHERE eventid='".$myvar."'"); while($row = mysql_fetch_assoc($sql)){ $eventid = $row["eventid"]; $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# echo ' <form id="form1" name="form1" method="post" action="quickregister.php">'; echo "<center><table border='1' width='600'>"; // Example of testing title1 for the userid (already registered) ... echo "<tr><td width='300'>"; if (!empty($title1)) { echo "<select name=\"title1\" id=\"title1\"> <option value=\"$title1\">$title1</option>";} if (!empty($title2)) { echo "<select name=\"title2\" id=\"title1\"> <option value=\"$title2\">$title2</option>";} if (!empty($title3)) { echo "<select name=\"title3\" id=\"title1\"> <option value=\"$title3\">$title3</option>";} if (!empty($title4)) { echo "<select name=\"title4\" id=\"title1\"> <option value=\"$title4\">$title4</option>";} if (!empty($title5)) { echo "<select name=\"title5\" id=\"title1\"> <option value=\"$title5\">$title5</option>";} if (!empty($title6)) { echo "<select name=\"title6\" id=\"title6\"> <option value=\"$title6\">$title6</option>";} if (!empty($title7)) { echo "<select name=\"title7\" id=\"title1\"> <option value=\"$title7\">$title7</option>";} if (!empty($title8)) { echo "<select name=\"title8\" id=\"title1\"> <option value=\"$title8\">$title8</option>";} echo "</select>"; echo "<input type='hidden' name='eventid' value='$eventid'>"; echo "<input type='hidden' name='event' value='$event'>";} ?> <p> <center> <table width="323" border="1" cellspacing="2" cellpadding="2"> <tr> <th width="58" scope="col"> </th> <th width="245" scope="col"> </th> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> <br /></td> <td><?php $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while ($member = mysql_fetch_array($select)) { echo '<input type="checkbox" name="user[]" value="'.$member[name].'">'.$member[name].'<br><input type="hidden" name="email1[]" value="'.$member[email].'"><input type="text" name="userid1[]" value="'.$member[userid].'"><input type="text" name="id1[]" value="'.$member[userid].','.$eventid.'">'; } ?></td> </tr> <tr> <td> </td> <td> <!-- Textarea gets replaced with TinyMCE, remember HTML in a textarea should be encoded --></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" id="submit" value="Post" /></td> </tr> </table></center> <p> </p> <p> </p> <p> </p> <p> </p> </form> <?php if ($_POST[submit]){ foreach ($_POST[user] as $key => $value) { $userid1 = $_POST[userid1][$userid]; $email1 = $_POST[email1][$key]; $id1 = $_POST[id1][$key]; // [..] code that adds the message to the database $title1 = $_POST['title1']; $title2 = $_POST['title2']; $title3 = $_POST['title3']; $title4 = $_POST['title4']; $title5 = $_POST['title5']; $title6 = $_POST['title6']; $title7 = $_POST['title7']; $title8 = $_POST['title8']; $eventid = $_POST['eventid']; $event = $_POST['event']; $query ="insert into Events(title1, title2, title3, title4, title5, title6, title7, title8, userid, name, eventid, event, email, price1, price2, price3, price4, price5, price6, price7, price8, barcode, verified, id) VALUES ('$title1', '$title2', '$title3', '$title4', '$title5', '$title6', '$title7', '$title8', '$userid1', '$value','$eventid', '$event', '$email1', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', '$id1')"; mysql_query($query) or die(mysql_error()); echo mysql_error(); echo $query; echo "Registrations verified"; }} ?>
  7. ok, so I put it in a different place and now I need it to display $member[rank] in a cell next to the name...........I can only manage to make it under the name.........how can I do this? <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT name FROM members"); while($row = mysql_fetch_array($sql)){ $name = $row['name']; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; } require('fpdf.php'); class PDF extends FPDF { //Page header function Header() { //Logo //Arial bold 15 $this->SetFont('Arial','B',15); //Move to the right $this->Cell(80); //Title $this->Cell(30,10,'',1,0,'C'); $this->Ln(20); $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while($member = mysql_fetch_array($select)) { $this->Cell(50,10,"$member[name]",1,1); $this->Cell(50, 10, "$member[rank]", 1,1);} //Line break $this->Ln(20); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','I',; //Page number $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } } //Instanciation of inherited class $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Times','',12); for($i=1;$i<=40;$i++) $pdf->Output(); ?>
  8. well, I want it to display all names from database, right now it is only displaying my name multiple times!
  9. how do I make a pdf that will display all results from a table or selected results, such as all names. ..........here is one that i started on but isn't working....... <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members"); while($row = mysql_fetch_array($sql)){ $name = $row['name'][$key]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; } $name1 = $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while ($member = mysql_fetch_array($select)) { ''.$member[name].''; } require('fpdf.php'); class PDF extends FPDF { //Page header function Header() { global $name1; //Logo //Arial bold 15 $this->SetFont('Arial','B',15); //Move to the right $this->Cell(80); //Title $this->Cell(30,10,'',1,0,'C'); //Line break $this->Ln(20); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','I',; //Page number $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } } //Instanciation of inherited class $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Times','',12); for($i=1;$i<=40;$i++) $pdf->Cell(0,10, $name ,0,1); $pdf->Output(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> </body> </html>
  10. Ok, so I need to know how I can get these codes to interact and work to update multiple rows/columns in a database. this code is what pulls the query and displays info(it displays fine): <?php if (isset($_POST['submitted'])) { include('connect1.php'); $category = $_POST['category']; $criteria = $_POST['criteria'] ; $query = ("SELECT name, badges, rank, userid FROM members WHERE $category LIKE '%".$criteria."%'"); $result = mysqli_query($dbcon, $query) or die('error getting data'); $num_rows = mysqli_num_rows($result); echo "$num_rows results found"; echo "<table width=\"896\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr bgcolor=\"#F7E496\"><td bgcolor=\"#F7E496\"><strong>name</strong></td><td bgcolor=\"#F7E496\" ><strong>Merit Badges</strong></td><td bgcolor=\"#F7E496\"><strong>Rank</strong></td><td bgclor=\"#F7E496\"></td></tr>"; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {$color = ($color == 'white')?'#fffccc':'white'; echo "<tr bgcolor='$color'><td> "; echo $row['name']; echo " </td><td> <form action=\"scout.php\" method=\"post\"> <input type=\"text\" name=\"userid\" id=\"userid\" value='".$row['userid']."'> <textarea name=\"badges[]\" id=\"badges\" cols=\"40\" rows=\"3\" type=\"textarea\">".$row['badges']."</textarea></td><td> <span class=\"adfa\"> </span> <select name=\"rank[]\" id=\"rank\"> <option value=\"Scout\">Scout</option> <option value=\"Tenderfoot\">Tenderfoot</option> <option value=\"Second Class Scout\">Second Class Scout</option> <option value=\"First Class Scout\">First Class Scout</option> <option value=\"Star Scout\">Star Scout</option> <option value=\"Life Scout\">Life Scout</option> <option value=\"Eagle Scout\">Eagle Scout</option> <option value=\"\" selected=\"selected\">".$row['rank']."</option> </td><td>"; } echo "</td></tr>"; echo "</table>"; echo "<input type=\"submit\" name='submit[]' id=\"submit\" value=\"Save\" /> </form>"; } ?> and this code is what is supposed to update the database: if ($_POST[submit]){ foreach ($_POST[rank] as $key => $value) { $badges = $_POST['email1'][$key]; $userid1 = $_POST['userid'][$key]; $q = "UPDATE members SET badges='$badges', rank='$rank' where userid='$userid1'"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error()); printf("Records updated: %d\n", mysql_affected_rows());} exit(); } // close if post again, I am really new to arrays and don't know If i am using them right here......... :confused: :confused: :confused: :confused:
  11. thanks, your awesome, it works, like I said, I am new to arrays.
  12. ya, forgot bout that. thanks.......anyways, now it posts multiples but it is putting the same person 12 times!
  13. ok, well if I try to post one person, it works, but still says query failed.........could this be a loop issue?
  14. no, still not working <?php if ($_POST[submit]){ foreach ($_POST[user] as $key => $value){ // [..] code that adds the message to the database $title1 = $_POST['title1']; $title2 = $_POST['title2']; $title3 = $_POST['title3']; $title4 = $_POST['title4']; $title5 = $_POST['title5']; $title6 = $_POST['title6']; $title7 = $_POST['title7']; $title8 = $_POST['title8']; $value1 = $_POST['userid']; $value2 = $_POST['email']; $eventid = $_POST['eventid']; $event = $_POST['event']; $query ="insert into Events(title1, title2, title3, title4, title5, title6, title7, title8, userid, name, eventid, event, email, price1, price2, price3, price4, price5, price6, price7, price8, barcode, verified) VALUES ('$title1', '$title2', '$title3', '$title4', '$title5', '$title6', '$title7', '$title8', '$value1', '$value','$eventid', '$event', '$value2', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick')"; mysql_query($query) or die('Error, query failed'); } } ?> echo "<form action ='quickregister.php' method='post'>"; echo "<center><table border='1' width='600'>"; // Example of testing title1 for the userid (already registered) ... echo "<tr><td width='300'>"; if (!empty($title1)) { echo "<select name=\"title1\" id=\"title1\"> <option value=\"$title1\">$title1</option>";} if (!empty($title2)) { echo "<select name=\"title2\" id=\"title1\"> <option value=\"$title2\">$title2</option>";} if (!empty($title3)) { echo "<select name=\"title3\" id=\"title1\"> <option value=\"$title3\">$title3</option>";} if (!empty($title4)) { echo "<select name=\"title4\" id=\"title1\"> <option value=\"$title4\">$title4</option>";} if (!empty($title5)) { echo "<select name=\"title5\" id=\"title1\"> <option value=\"$title5\">$title5</option>";} if (!empty($title6)) { echo "<select name=\"title6\" id=\"title6\"> <option value=\"$title6\">$title6</option>";} if (!empty($title7)) { echo "<select name=\"title7\" id=\"title1\"> <option value=\"$title7\">$title7</option>";} if (!empty($title8)) { echo "<select name=\"title8\" id=\"title1\"> <option value=\"$title8\">$title8</option>";} echo "</select>"; echo "<input type='hidden' name='eventid' value='$eventid'>"; echo "<input type='hidden' name='event' value='$event'>";} ?> <p> <center> <table width="323" border="1" cellspacing="2" cellpadding="2"> <tr> <th width="58" scope="col"> </th> <th width="245" scope="col"> </th> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> <br /></td> <td><?php $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while ($member = mysql_fetch_array($select)) { echo '<input type="checkbox" name="user[]" value="'.$member[name].'">'.$member[name].'<br><input type="hidden" name="userid" value="'.$member[userid].'"><input type="hidden" name="email" value="'.$member[email].'">'; } ?></td> </tr> <tr> <td> </td> <td><input type="hidden" name="event" id="<?php echo $event; ?>" /></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" id="submit" value="Post" /></td> </tr> </table></center> </form>
  15. yeah it works just fine.........maybe this will give you idea why it no work...........I am trying to post multiple values at a time.........it could be a problem with a loop too maybe? but this is like a page where I select checkboxes and register the selected for an event.
  16. well, its not posting at all.
  17. what do you mean what its turning out to be?
  18. I am new to using arrays..........so I don't really know what is wrong here, could someone please help, it is not posting properly.........I think it has to do with arrays: <?php $sql = mysql_query("SELECT * FROM Registration WHERE eventid='".$_GET['eventid']."'"); while($row = mysql_fetch_array($sql)){ $eventid = $row["eventid"]; $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# echo "<form action ='quickregister.php' method='post'>"; echo "<center><table border='1' width='600'>"; // Example of testing title1 for the userid (already registered) ... echo "<tr><td width='300'>"; if (!empty($title1)) { echo "<select name=\"title1\" id=\"title1\"> <option value=\"$title1\">$title1</option>";} if (!empty($title2)) { echo "<select name=\"title2\" id=\"title1\"> <option value=\"$title2\">$title2</option>";} if (!empty($title3)) { echo "<select name=\"title3\" id=\"title1\"> <option value=\"$title3\">$title3</option>";} if (!empty($title4)) { echo "<select name=\"title4\" id=\"title1\"> <option value=\"$title4\">$title4</option>";} if (!empty($title5)) { echo "<select name=\"title5\" id=\"title1\"> <option value=\"$title5\">$title5</option>";} if (!empty($title6)) { echo "<select name=\"title6\" id=\"title6\"> <option value=\"$title6\">$title6</option>";} if (!empty($title7)) { echo "<select name=\"title7\" id=\"title1\"> <option value=\"$title7\">$title7</option>";} if (!empty($title8)) { echo "<select name=\"title8\" id=\"title1\"> <option value=\"$title8\">$title8</option>";} echo "</select>"; echo "<input type='hidden' name='eventid' value='$eventid'>"; echo "<input type='hidden' name='event' value='$event'>";} ?> <p><form id="form1" name="form1" method="post" action="quickregister.php"> <center> <label for="title1"></label> <table width="323" border="1" cellspacing="2" cellpadding="2"> <tr> <th width="58" scope="col"> </th> <th width="245" scope="col"> </th> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> <br /></td> <td><?php $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while ($member = mysql_fetch_array($select)) { echo '<input type="checkbox" name="user[]" value="'.$member[name].'">'.$member[name].'<br><input type="hidden" name="userid[]" value="'.$member[userid].'"><input type="hidden" name="email[]" value="'.$member[email].'">'; } ?></td> </tr> <tr> <td> </td> <td><input type="hidden" name="eventname" id="<?php echo $eventname; ?>" /></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" id="submit" value="Post" /></td> </tr> </table></center> </form> <?php if ($_POST['submit']){ foreach ($_POST[user] as $key => $value) foreach ($_POST[userid] as $key => $value1) foreach ($_POST[email] as $key => $value2){ // [..] code that adds the message to the database $title1 = $_POST['title1']; $title2 = $_POST['title2']; $title3 = $_POST['title3']; $title4 = $_POST['title4']; $title5 = $_POST['title5']; $title6 = $_POST['title6']; $title7 = $_POST['title7']; $title8 = $_POST['title8']; $eventid = $_POST['eventid']; $event = $_POST['event']; $query ="insert into Events(title1, title2, title3, title4, title5, title6, title7, title8, userid, name, eventid, event, email, price1, price2, price3, price4, price5, price6, price7, price8, barcode, verified) VALUES ('$title1', '$title2', '$title3', '$title4', '$title5', '$title6', '$title7', '$title8', '$value1', '$value','$eventid', '$event', '$value2', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick', 'quick')"; mysql_query($query) or die('Error, query failed'); } exit(); } ?>
  19. how can I make it work with this form code? all the other stuff like connecting and stuff is set up...........: form: <form id="form1" name="form1" method="post" action="newmess.php"> <center> <table width="323" border="1" cellspacing="2" cellpadding="2"> <tr> <th width="58" scope="col">Subject: <label for="subject"></label></th> <th width="245" scope="col"><input type="text" name="title" id="subject" /></th> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> <br /></td> <td><?php $select = mysql_query("SELECT * FROM members") or die(mysql_error()); while ($member = mysql_fetch_array($select)) { echo '<input type="checkbox" name="user[]" value="'.$member[name].'">'.$member[name].'<br>'; } ?></td> </tr> <tr> <td><label for="content2">Content:</label></td> <td><textarea name="content" id="content" cols="45" rows="5"></textarea></td> </tr> <tr> <td><input type="hidden" name="from" id="from" value='<?php echo $name; ?>' /></td> <td><input type="submit" name="submit" id="submit" value="Post" /></td> </tr> </table></center> <p> </p> <p> </p> <p> </p> <p> </p> </form> posting: <?php if ($_POST[user]){ foreach ($_POST[user] as $key => $value){ // [..] code that adds the message to the database $content = $_POST['content']; $from = $_POST['from']; $subject = $_POST['title']; $query ="insert into messages(title, content, recipient, from1) VALUES ('$subject', '$content', '$value','$from')"; mysql_query($query) or die('Error, query failed'); } } ?>
  20. I have info being pulled from 2 tables, I need to know how I can order by date from both table intermixing.............like table 2 has the soonest timestamp, then table 1 has the next , then table 2 has the one after that, how do I make it display info in order of table 2 info, table 1 info, table 2, info...........here is code that I been trying to use: <?php include 'config.php'; include 'opendb.php'; // if no id is specified, list the available articles if(!isset($_GET['id'])) { $query = "SELECT * FROM messages WHERE recipient ='$name' order by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($from1, $recipient, $title1, $content, $id, $date, $read) = $row; if ($read == $userid){ $content1 .= "<br /><br /> $from1</p>\r\n"; $content2 .= "<br /><br /> <a href=\"/message.php?id=$id\">$title1</a>\r\n"; }else{ $content1 .= "<br /><br /> <strong>$from1</strong></p>\r\n"; $content2 .= "<br /><br /> <a href=\"/message.php?id=$id\">$title1</a>\r\n"; }} }else { // get the article info from database $query = "SELECT * FROM messages WHERE recipient='$name' ORDER by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $title = $row['title']; $content = $row['content']; $to = $row['recipient']; $from = $row['from1']; $id = $row['id']; $read = $row['read']; } // if no id is specified, list the available articles if(!isset($_GET['id'])) { $self = $_SERVER['PHP_SELF']; $query = "SELECT * FROM comments WHERE recipient='$name' order by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($com_id, $userid, $id1, $id, $recipient, $comment, $sender, $title, $date, $read) = $row; if ($read == $userid){ $content1 .= "<br /><br /> $from1</p>\r\n"; $content2 .= "<br /><br /> <a href=\"/message.php?id=$id\">$title</a>\r\n"; }else { $content1 .= "<br /><br /> <strong>$from1</strong></p>\r\n"; $content2 .= "<br /><br /> <a href=\"/message.php?id=$id\">$title</a>\r\n"; }} } else { // get the article info from database $query = "SELECT * FROM comments WHERE recipient='$name' order by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $userid = $row['userid']; $id1 = $row['id1']; $id = $row['messageid']; $recipient = $row['recipient']; $comment = $row['comment']; $sender = $row['sender']; $title = $row['title']; $read = $row['read']; } include 'closedb.php'; ?>
  21. ok, I realize now that I had a string error.........
  22. so, I got that working, but now it displays the last result twice, why?
  23. ok, so how do I edit the css to do this?
  24. ok, so here is the basic concept I want, but it is not working, everything is bold when the database is set to 1 for $read........could you take a look and help?: <?php include 'config.php'; include 'opendb.php'; // if no id is specified, list the available articles if(!isset($_GET['id'])) { $query = "SELECT * FROM messages WHERE recipient ='$name' order by date desc"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($from1, $recipient, $title1, $content, $id, $date, $read) = $row; if ($read == $userid){ $content1 .= "<br /><br /> $from1</p>\r\n"; $content2 .= "<br /><br /> <a href=\"/message.php?id=$id\">$title1</a>\r\n"; }else { $content1 .= "<br /><br /> <strong>$from1</strong></p>\r\n"; $content2 .= "<br /><br /> <a href=\"/message.php?id=$id\">$title1</a>\r\n"; }
×
×
  • 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.