boionfire81 Posted April 2, 2016 Posted April 2, 2016 To start with Fatal error: Uncaught Error: Call to undefined function mysql_query() in /home/public_html/workshop.php:491 Stack trace: #0 /home/public_html/workshop.php(45): staff_panel() #1 {main} thrown in /home/public_html/workshop.php on line 491 Quote
Zettieee Posted April 2, 2016 Posted April 2, 2016 Upload the file. You're not providing the information we need to help YOU. Quote
boionfire81 Posted April 2, 2016 Author Posted April 2, 2016 Not sure what to post, because I'm sure cronus doesn't want to me to post his entire module here. But line 491 is $blah=mysql_query("SELECT * FROM workshop ORDER BY wITEM ASC",$c); Quote
KyleMassacre Posted April 2, 2016 Posted April 2, 2016 Dont upload the whole file but I am curious to what you have tried 1 Quote
Zettieee Posted April 2, 2016 Posted April 2, 2016 $blah = $db->query("SELECT * FROM workshop ORDER BY wITEM ASC"); Quote
KyleMassacre Posted April 2, 2016 Posted April 2, 2016 There is much more than that. You will need to follow the conversion from v1 to v2 tutorial and also add $db as a global in every function Quote
Zettieee Posted April 3, 2016 Posted April 3, 2016 Cronus is back so why not msg him and have him fix it? Quote
boionfire81 Posted April 9, 2016 Author Posted April 9, 2016 ok, so what it has come down to at this point I believe anyways is this else { print"<table width=50% border=1><tr><th colspan=2>Adding An Item To The Workshop...</th></tr><tr><td><center>Item To Create:</center></td><td><center><br><form action='workshop.php?action=itemcreate' method='post'> <select name=item>"; $nji=$db->query("SELECT * FROM items ORDER BY itmname ASC"); while ($list=$db->free_result($nji)) { print"<option value=' .{$list['itmid']}. '>' .{$list['itmname']}. '</option>"; } print"</select><br><br></td></tr> Originally the ' . . ' where not there but I'm trying lol! Issue is when attempting to make/select item to create the item list returns blank. Quote
KyleMassacre Posted April 9, 2016 Posted April 9, 2016 I think your free_result needs to be fetch_row Quote
boionfire81 Posted April 9, 2016 Author Posted April 9, 2016 (edited) ok tried <select name=item>"; $nji=$db->query("SELECT * FROM items ORDER BY itmname ASC"); while ($list=mysqli_fetch_row($nji)) { print"<option value=' .{$list['itmid']}. '>{$list['itmname']}</option>"; } and still nothing Edited April 9, 2016 by boionfire81 updated code Quote
KyleMassacre Posted April 10, 2016 Posted April 10, 2016 In theory it should work and I want to thank you for attempting this yourself. Just so you know, while() will execute the code in a loop as long as what's in the while as a parameter will return true. So basically what it's saying if you are not getting any results is that your query is not returning any rows or "ferching" and rows. Now, what could potentially be your issue is that mysqli_fetch_row() doesn't actually exists. You have 2 choices and in order of best to worst I would change your mysqli_fetch_row() to $db->fetch_row() or change it to mysqli_stmt_fetch() Quote
boionfire81 Posted April 10, 2016 Author Posted April 10, 2016 Almost have this finished. modified the real escape string thanks to [uSER=69001]Zettieee[/uSER] but now I have the mysql_fetch_array that doesn't work >.< Quote
KyleMassacre Posted April 10, 2016 Posted April 10, 2016 $nji=$db->query("SELECT * FROM items ORDER BY itmname ASC"); while ($list=$db->fetch_row($nji)) // mysqli_fetch_row() to $db->fetch_row() { print"<option value=' {$list['itmid']}'>{$list['itmname']}</option>"; } Quote
boionfire81 Posted April 10, 2016 Author Posted April 10, 2016 Sorry didn't post the code $lso=$db->query("SELECT * FROM items WHERE itmid={$ws['wITEM']}"); $item=mysql_fetch_array($lso); Quote
Zettieee Posted April 10, 2016 Posted April 10, 2016 $db->fetch_row() instead of mysql_fetch_array() Some cases, it might be good to use fetch_assoc() [cant remember if mccodes uses assoc instead of row for its class] Quote
boionfire81 Posted April 10, 2016 Author Posted April 10, 2016 mysql_fetch_row() expects parameter 1 to be resource, object given Just noticed my forum sig. I have alot of mods going, so probably gonna need to truncate. Quote
KyleMassacre Posted April 10, 2016 Posted April 10, 2016 MCCodes just uses the fetch_row() which uses the fetch_assoc equivalent Quote
boionfire81 Posted April 10, 2016 Author Posted April 10, 2016 Think it is 100 now :) I found some issues were the $db wasn't being called from the global line >.< how did he miss that??? Quote
boionfire81 Posted April 10, 2016 Author Posted April 10, 2016 ok, one last thing I hope. As now it's testing time. I want to fix this first PHP Notice: Undefined index: action for when there are workshop.php?action=blah Someone told me once, but I lost that post. Wish I could save this one as a reference. But the like button doesn't work :/ Quote
boionfire81 Posted April 10, 2016 Author Posted April 10, 2016 Could be. But before posting as a paid mod, you'd think it was converted. Quote
KyleMassacre Posted April 10, 2016 Posted April 10, 2016 Because it was using the old mysql_query()'s. That's why I told you that you will have to add $db as a global variable in your functions. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.