Jump to content

JamesThePanda

Members
  • Posts

    133
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

JamesThePanda's Achievements

Regular Member

Regular Member (3/5)

2

Reputation

  1. Thank you I think its the array_unique function. I'm sorry for asking such a obvious question , I'm dyslexic so sometimes I miss things that are right in front of me. Thanks James
  2. array (james, john, pingo, adam, john, james, pingo, barney, pingo, ); I was wondering if there is an in-built PHP function that would list all the names once. IE james john pingo adam barney not : james john pingo adam john james pingo barney pingo I have been googling this and cant seem to fnd what I want, having a hard time explain it in a google search term. Thanks James
  3. $rowNo = 0; while($res = mysql_fetch_array($result)) { $rowNo++; //Increment Row Number $date = date("D, j M, Y", $res['time']); $center = strtoupper($res['center']); if($res['approval'] == "Yes") { $approvalText = "Approved": $approvalColor = '#CDE861'; } else if($res['approval'] == "No") { $approvalText = "Rejected": $approvalColor = '#F28598'; } else { $approvalText = "Pending": $approvalColor = '#EDA553'; }?> <tr align='center' bgcolor='<?php {$approvalColor} \n ?>'> <td style='color:black;'><?php {$rowNo}; ?></td> <td style='color:black;'><?php {$res['randid']}; ?></td> <td style='color:black;'><?php {$center}; ?></td> <td style='color:black;'><?php {$res['customer_name']}; ?></td> <td style='color:black;'><?php {$res['home_phone']}; ?></td> <td style='color:black;'><?php {$date}; ?></td> <td><?php {$approvalText}; ?></td> <td><a href ="view.php?id=<?php {$res['id']}; ?>"><center>Click to View </center></a></td><br /> //And continue on for other rows </tr><br /><?php } sorry but thats the better way to right it instead of using all the echo codes
  4. can you give us more information on the project, like the code you already have and the fields in the database, also what ce do you current have. you need to tell us what you have what you intended it to do and what you want it to do.
  5. also instead of print_r try var_dump Thats should give you more information and remember to use <pre> tags
  6. the process you need to go through is input the the $_POST fields into an array. $varible1 = $_POST['first_name']; $varible2 = $_POST['last_name']; $varible3 = $_POST['company']; $varible4 = $_POST['email']; $array = array($varible1, $varible2, $varible3, $varible4,); foreach($array as $B){ $c[] = str_replace(' ', '_', $B); } this will gie you a formatted array.
  7. Hi thanks for that I replace that li with your code, Now im getting an error on line 20 it makes no sence <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!isset($_POST['id'])){ mysql_select_db("product", $con); $result = mysql_query("SELECT * FROM product2"); echo'<form method="post" action="pro.php">'; while($row = mysql_fetch_array($result)) { echo '<tr><td><input type="checkbox" name="uid[]" value="'.$row['ID'].'" /></td><td>"'.$row['filename'].'"</td><td>"'.$row['title'].'"</tr>'; } echo '<input type="submit" name="formSubmit" value="Submit" /></form>'; ?> Thanks James
  8. ok here is the new "improved" code. Also I'm getting a parse error on line 16 <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!isset($_POST['id'])){ mysql_select_db("product", $con); $result = mysql_query("SELECT * FROM product2"); echo'<form method="post" action="pro.php">'; while($row = mysql_fetch_array($result)) { echo '<tr><td><input type="checkbox" name="uid[]" value=".$row['ID']." /></td><td>".$row['filename']."</td><td>".$row['title']."</tr>'; } echo '<input type="submit" name="formSubmit" value="Submit" /></form>'; ?>
  9. ok this is what I have but for some reason its stoped working geting a parse error on the last line <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!isset($_POST['id'])){ mysql_select_db("product", $con); $result = mysql_query("SELECT * FROM product2"); echo'<form method="post" action="pro.php">'; while($row = mysql_fetch_array($result)) { echo "<tr><td><input type=\"checkbox\" name=\"uid[]\" value=\"".$row['ID']."\" /></td><td>".$row['filename'] . "</td><td> " . $row['title']. "</tr> "; } echo '<input type=\"submit\" name=\"formSubmit\" value=\"Submit\" />'; echo '</form>'; mysql_close($con); ?>
  10. hmmm now its only returning a single result I have a group checklist HTML form that were the array is started. I wanted the script to pull details from the database when I select certain items. now if I sect multiple items it only returns one result.
  11. Hi I cant understand why this code isnt echoing the results. $ids = $_POST['uid']; $con = mysql_connect("localhost","root",""); mysql_select_db("product", $con); $sqlout = mysql_query("SELECT * FROM product2 WHERE 'ID' IN ('$ids')"); while ($sqlres = mysql_fetch_assoc($sqlout)) { echo $sqlres['filename'] . " " . $sqlres['title']; } mysql_close($con); Anyone got any ideas? Thanks James
  12. Yes Chris, that solved tht problem but a new one has poped up. Thank you for your help its much appreciated Thanks James
×
×
  • 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.