Jump to content

JamesThePanda

Members
  • Posts

    133
  • Joined

  • Last visited

Everything posted by JamesThePanda

  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
  13. Hi I made some adjustments to the code, $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); Im wondering why it isnt echoing the results? Any thoughts
  14. here is were im setting the variable $ids = $_POST['uid'];
  15. Hi I have been getting this error. mysql_fetch_array() expects parameter 1 to be resource, boolean given Its driving me mad I know its something really simple. Can anyone see what it is? mysql_select_db("product", $con); $sqlout = mysql_query("SELECT * FROM 'tblt' WHERE 'UID' =('$ids')"); while($sqlres = mysql_fetch_array($sqlout)) Thanks James
  16. Why dont you just serialize the array It would be simplier and remember to deserial it when extracting it.
  17. Hi Cunoodle For some reason its starte working now I been playing wit it for a hour or so. I think the problem was i was getting the data from a file and looking for several tags all at once. I just split them up a bit and thats seems to work Thanks SO much for you help James
  18. snip echo out fine in regards to finding just "<div id=" there several div tages in the code would it end up giving the position off all of them. thanks James
  19. Hi Im having a problem finding the posistion of a div tag I tried this piece of code $fpos= strpos($snip, "<div id=\"footer\">") Then this piece $fpos= strpos($snip, "<div id="footer">") The $snip is the entire html document I thought maybe the \ might be causeing problem but without it Then i tried this any suggestions guys Thanks James
  20. im still no futher on this if anyone could help
  21. ALso i ran a check and it not coming up as a object or an array
  22. Hi Im just working on a wordpress pugin at the moment and Iw as trying out this piece of code $mylink = $wpdb->get_row("SELECT * FROM $wpdb->testtable WHERE id = 1"); echo $mylink->id ; there is data in the table there is an id equal to one but it not coming up with anything I tried it with anouther pable and it works fine I can for example $mylink = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE id = 1"); echo $mylink->post_content ; That comes up fine with the data But the first one I dont know why its not working can anyone help 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.