-
Posts
271 -
Joined
-
Last visited
Everything posted by blacknight
-
is what it shows you what is in the database?
-
yea basicly i see that now ... try this.. echo "<option value='{$row['location_id']}'"; //Default value if(isset($_POST['location']) && $row['location_id'] == $_POST['location']) echo " selected "; echo ">{$row['location_name']}</option>\n";
-
add if(isset($_POST['location']) && $row['location_id'] == $_POST['location']) echo " selected "; this working of the form is submitted to its self for further updates...
-
Too many if isset statements, better way to handle?
blacknight replied to flambo's topic in PHP Coding Help
isset is the built in function try defining the $_GET vars at the start of the function using shorter names... -
add echo $cid. ' - '.$catname.' - '.$catdesc. ' - ' .(bool)$ok; after your global statement and see if the values are even passing to the function... and if youa re getting a sql error post it please
-
drop the $stmt = $db->stmt_init(); $stmt = $db->prepare("UPDATE category SET catname=?,catdesc=? WHERE cid=?"); $stmt->bind_param('ssi',$catname,$catdesc,$cid); $stmt->execute(); $stmt->close(); and just use a normal sql update string.... $result = $db->query("UPDATE `category` SET `catname`='$catname',`catdesc`='$catdesc' WHERE `cid`='$cid'"); only thing i can sujest because you dident post the $stmt function file ... but that seems like a lota work for an update ...
-
$db = mysql_connect(__CFG_HOSTNAME, __CFG_USERNAME, __CFG_PASSWORD, TRUE, MYSQL_CLIENT_INTERACTIVE) or die(mysql_error()); mysql_query("SET SESSION interactive_timeout=120", $db); mysql_select_db(__CFG_DATABASE, $db); this would set the connection to time outa fter 120 seconds
-
$_GET['id'] will still equal 10 in the rewrite so i cant see why not...
-
using php's gd lib you can do this just have to set the peramiters for the script
-
i need help with a long list of php features/codes
blacknight replied to deathadder's topic in PHP Coding Help
you dident md5 your password.... and if your webpage is not i strongly sugest you do ... as for limiting vote time .... add a time toamp to the user that is set for +24 hours and run a check if (time()=>$user['tstamp']) then let them vote -
PHP newbie, need help with file upload ...
blacknight replied to assassin316's topic in PHP Coding Help
both... php can only access the website folder not previous lower level directories if im not mistaken so you would need a server side batch file to move the file from the mydocuments to the webfolder or vise versa -
from whay i can tell you just need to pull the info from your database into an array and then encode it to json then pass it to the jquery script on page render then it should work..
-
function Auth() { if (($_SESSION['uname']) && ($_SESSION['access'] == 2)) { #if already logged in, redirect based on dept id if ($_SESSION['dept'] == 1) { header("Location: admin/index.php"); } elseif ($_SESSION['dept'] != 1) { header("Location: cases/cases-list.php"); } else { // If access is not GRANTED then reset and hold user at login page unset($_SESSION['uname']); unset($_SESSION['access']); header("Location: index.php"); } } } then call Auth(); at the top of all your pages
-
opps yea i see that now too some one shouldent be the sender and the reciver at the same time which is what the on statement is stating if you use ON (gold_logs.to_id = ibf_members.id OR gold_logs.from_id = ibf_members.id) it will list both sent and recived
-
once you left join you have to declare each table each field is from im guessing form_id and to_id are in gold_logs SELECT gold_logs.*,name,star FROM gold_logs LEFT JOIN ibf_members ON (gold_logs.to_id = ibf_members.id AND gold_logs.from_id = ibf_members.id) WHERE gold_logs.to_id = 1 and see if that works..
-
add #jump to your action setting in the form tag at the start this will go direct to the name tag
-
use the # http var like #start in a link then <a name="start"></a> will move the page to this location
-
Need help with php mysql database - maintenance?
blacknight replied to andy_b_1502's topic in PHP Coding Help
setting your username and email as keys on your user table will stop multiple samenames signing up too -
yea i forgot my $ infront of what_page lol
-
no i would set this for page width it sets how many colums you have going across the page 3-5 is usualy good depending on the size of the page
-
if (isset($_GET('what_page') { $what_page = int() $_GET('what_page'); if($what_page>3 OR $what_page<0) { what_page=0; } } should be all the code you need at the top after your array your else statement was allways setting your page to 0by not setting a else you let $what_page stay set if it passes the fail check
-
ever think of using a table? $html = '<table><tr>'; $cols = 3;// can be any size you want $x = 0; while ($row = mysql_fetch_array($sql)) { $x++; $reference = $row['reference']; $image = $row['image']; $html .= '<td>'; $html .= '<p><img src="./images/cakes/'.$image.'" height="289px" width="177px" alt="IMAGE OF CAKE"></img><br />'; $html .= '<b>Reference:</b>'.$reference.'.</p>'; $html .= '</td>'; if ($x == $cols) { $html .= '</tr><tr>'; $x=0; } } if (!$reference) { $html .= '<td>There are no cakes in this category yet.</td>'; } echo $html;
-
if you set size(w/h) and size (k Kb Mb) limits and check the mime type any file that passes your checks should be ok but i wouldent recomend any folder before your webroot folder use one called uploads in it then you can have php move it after its uploaded
-
try taking out your <p> tages same idea makes paragraphs under each other
-
PHP/mySQL query skip repeated results in column header
blacknight replied to nullpoint81's topic in PHP Coding Help
place your </table at the end of the first foreach loop