Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Everything posted by phpretard

  1. How can I pull just the "123" out of $var. The numbers after the dash could be up to 10 digits In the end I need eliminate the dash and put everything after the dash into $var2 $var="41bab296a65b71736b464f8aff39b342-123" $var1="41bab296a65b71736b464f8aff39b342"; $dash="gone"; $var2="123"; Thank you.
  2. if you are going to do that... <html> <body> <?php $db_connect = mysql_connect("xxxx.com", "xxxx_user", "password"); mysql_select_db("xxxx_database"); $query="SELECT * FROM Directory"; $result=mysql_query($query); $num=mysql_num_rows($result); // CHANGE IT HERE mysql_close(); print "<h1><center>My Directory</center></h1><br>"; $i=0; while ($i < $num) { echo "Search Results: $num found"; // CHANGE HERE $Name=mysql_result($result,$i,"Name"); $LastName=mysql_result($result,$i,"LastName"); $FirstName=mysql_result($result,$i,"FirstName"); $Phone=mysql_result($result,$i,"Phone"); $Mobile=mysql_result($result,$i,"Mobile"); $Email=mysql_result($result,$i,"Email"); $Web=mysql_result($result,$i,"Web"); $State=mysql_result($result,$i,"State"); $Country=mysql_result($result,$i,"Country"); echo "<b>$Name</b><br> FirstName: $FirstName<br> Home Phone: $Phone<br> Mobile: $Mobile<br> Email: $Email<br> Web Site: $Web<br> State: $State<br> Country:$Country<br><hr><br>"; $i++; } ?> </body> </head>
  3. You are right... I was trying to save a little time but look how much I've spent (yours and mine) with band-aids Thank you for your help!!! I will just rebuild it the right way.
  4. Are your other cron scripts running with the same %20%?
  5. echo " <tr> <td width=\"279\"><div align=\"center\">$battle[username]</div></td> <td width=\"206\"><div align=\"center\">$battle[clan]</div></td> <td width=\"55\"><div align=\"center\"> <a href=\"profile.php?profile=".$battle[username]."\">attack</a></div></td> <td width=\"68\"><div align=\"center\">$battle[wins]</div></td> <td width=\"68\"><div align=\"center\">$battle[lose]</div></td> </tr> ";
  6. /usr/local/bin/php /home/xxxxxx/domains/xxxxxx/public_html/mydir/myfile.php > /dev/null 2>&1 is that space actually there? /usr/local/bin/php---space---/home/xxxxxx/domains/xxxxxx/public_html/mydir/myfile.php > /dev/null 2>&1 %20%
  7. I apologize for that... I am trying to fix someone elses mess and it seemed the easiest way to resolve was to comma seperate in the (field "type") in the table "bugs"), then reference the table I added called (categories) that has six entries (which are the categories). [attachment deleted by admin]
  8. body{ border-top:blue solid 3px; border-bottom:blue solid 3px; } As far as I know the body will be on a white background if not otherwise specified...
  9. Comma seperation comes from: if (isset($_POST['submit'])){ $categories=implode(", ", $_POST['categories']); connect(); $insert=mysql_unbuffered_query("update bugs2 set type = '$categories' where id='".intval($_POST['id'])."' ") or die(mysql_error()); } So when I update it changes the values in the DB (with the simplified code Hooray!) it's the display that's killing me...it still won't show "checked" boxes
  10. Is this code to replace part or all of the existing? I ask because it still gives me all blank checkboxes...although it does display all the checkboxes The (comma seperated) value of b.type='value2, value4, value6' Should I not comma seperate? That is some great code by the way! It all makes sense to me except for: --- ".((is_null($all['type'])) ? '' : 'checked' )." --- I don't quite understand why the question mark and the colon are there.
  11. I "hardcoded" the id to 20(known to have the right info) and I get: Column 'id' in on clause is ambiguous What does that mean? I am researching as you (will hopefully) respond. THANK YOU!!!
  12. It still didn't work for some reason... Can you see any other issues?
  13. My objective is to get the comma seperated values from an individual row and display them as checkboxes. $all_cats[] = value1, value2, value3, value4, value5, value6 <- all should be displayed as checkboxes $type[]= value2, value4, value6 <-- these should be "checked" <?php connect(); $get_current_categories = mysql_query("select * from bugs2 where id='".$_GET['id']."' ") or die(mysql_error()); while ($cat_check = mysql_fetch_assoc($get_current_categories)) { $type[]=$cat_check['type']; } $imp=implode(", ", $type); $exp=explode(", ", $imp); $get_all_categories = mysql_query("select * from types order by name ") or die(mysql_error()); while ($all = mysql_fetch_assoc($get_all_categories)) { $all_cats[] = $all['name']; } foreach($all_cats as $category) { if(in_array($exp, $all_cats)){ // PROBLEM IS HERE I BELIEVE $selected = "<input type=\"checkbox\" name=\"categories[]\" value=\"$category\" checked />$category"; }else{ $selected = "<input type=\"checkbox\" name=\"categories[]\" value=\"$category\" />$category"; } echo $selected; } free($get_current_categories); free($get_all_categories); ?> The problem is all the chackboxes show up but none are checked. I think I have pinpointed where the problem is but am unable to fix it. Thank you
  14. I have multiple rows in a table each containing a quantity field. how can I display the row values as seperate values? connect(); $show_cart=mysql_query("select qty from cart where cid='".$_SESSION['cid']."'"); while($show = mysql_fetch_assoc($show_cart)) { $addend=['qty']; }free($show_cart); Any Thoughts? Please don't move me...
  15. It still wonn't show "No Answer..." arrg
  16. Here is the rest of the code: function get_all_answers(){ connect(); $question_id = mysql_query("select id from questions order by RAND() LIMIT 1") or die(mysql_error()); while($id_q = mysql_fetch_assoc($question_id)) { $db_id=$id_q['id']; } $the_question = mysql_query("select question from questions where id = '".$db_id."' ") or die(mysql_error()); while($single_q = mysql_fetch_assoc($the_question)) { echo "<b><font size=\"2\">".$single_q['question']."</font></b><hr />"; } $all_answers=mysql_query("select * from answers where question = '".$db_id."' order by RAND() LIMIT 4") or die(mysql_error()); while($all=mysql_fetch_assoc($all_answers)) { $answer[]=$all['answer']; if (empty($all['answer'])) { $answer_list = "<input type=\"checkbox\" disabled /> <font size=\"2\">No Answer Asigned</font><br />"; } else { foreach($answer as $checkbox) { $answer_list = "<input type=\"checkbox\" name=\"answer\" value=\"".$all['id']."\" /> <font size=\"2\">".$all['answer']."</font><br />"; } } echo $answer_list; } free($question_id); free($the_question); free($all_answers); }
  17. Thanks for the quick response but, even the new code gives me a blank...
  18. If there are no answers in the DB it should read "No Answers Assigned" Can anyone see why it would just show up blank? The rest works fine ... if there are answers while($all=mysql_fetch_assoc($all_answers)) { $answer[]=$all['answer']; foreach($answer as $checkbox) { if (empty($answer)){ $answer_list = "<input type=\"checkbox\" disabled /> <font size=\"2\">No Answer Asigned</font><br />"; }else{ $answer_list = "<input type=\"checkbox\" name=\"answer\" value=\"".$all['id']."\" /> <font size=\"2\">".$all['answer']."</font><br />"; } } echo $answer_list; } //For the record it is properly indented in the code. The forum didn't indent for some reason. Thank you for looking!
  19. The Files uploading but I cant seem to get the extention after renaming it. Any thoughts? <?php function findexts($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } define ("FILEREPOSITORY","./"); if (is_uploaded_file($_FILES['file']['tmp_name'])) { if ((($_FILES["file"]["type"] != "image/gif") || ($_FILES["file"]["type"] != "image/jpeg") || ($_FILES["file"]["type"] != "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { echo "<p>Wrong file format format.</p>"; } else { $name = $_POST['name']; $exts= $_FILES['type']; $result = move_uploaded_file($_FILES['file']['tmp_name'], FILEREPOSITORY."/$name.$exts"); if ($result == 1) echo "<p>File successfully uploaded.</p>"; else echo "<p>There was a problem uploading the file.</p>"; } #endIF } #endIF ?> <form action="<?php print $PHP_SELF?>" enctype="multipart/form-data" method="post"> Last Name:<br /> <input type="text" name="name" value="" /><br /> Class Notes:<br /> <input type="file" name="file" id="file" value="" /><br /> <p><input type="submit" name="submit" value="Submit Notes" /></p> </form> Thank you!
  20. Warning: Wrong parameter count for mysql_query() The error above is a result of: $update_cat=mysql_unbuffered_query("update categories set cat_name='".$_POST['category']."' where id='".intval($_POST['id'])."') ") or die(mysql_query()); I have never seen a "Wrong parameter count" for an update. Any help?
  21. Here it is used in a different function: function cat_tr(){ connect(); $get_cat = mysql_query("select * from categories order by cat_name"); while ($cat=mysql_fetch_assoc($get_cat)) { echo" <tr> <td>".$cat['cat_name']."</td> <td><a href=\"javascript:void(0)\"><img border=\"0\" alt=\"Edit ".$cat['cat_name']."\" src=\"images/b_edit.png\" width=\"16\" height=\"16\"></a></td> <td><a href=\"javascript:void(0)\"><img border=\"0\" alt=\"Delete ".$cat['cat_name']."\" src=\"images/b_drop.png\" width=\"16\" height=\"16\"></a></td> <td>";myDate("categories");echo"</td> </tr> "; } mysql_free_result($get_cat); }
  22. Got it! function myDate($table){ connect(); $the_date=mysql_query("select date from $table"); while ($date=mysql_fetch_assoc($the_date)) { $startdate=$date['date']; }mysql_free_result($the_date); $predate=explode(' ', $startdate); $splitdate=explode('-', $predate[0]); $readDate="$splitdate[1]-$splitdate[2]-$splitdate[0]"; $new_date="$readDate"; echo $new_date; } myDate("categories"); ?>
×
×
  • 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.