Jump to content

manny

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by manny

  1. Looks like a syntax error here's all the file error_reporting(E_ALL ^ E_NOTICE); //Report all error except NOTICES $id = mss($_GET['id']); $page = (!$_GET['page'] || $_GET['page'] < 0) ? "1" : $_GET['page']; $page = ceil($page); $limit = 10; $start = $limit; $end = $page*$limit-($limit); if($id){ $sql = "SELECT * FROM `forum_topics` WHERE `id`='".$id."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "This topic does not exists!"; }else { $row = mysql_fetch_assoc($res); $sql2 = "SELECT admin FROM `forum_sub_cats` WHERE `id`='".$row['cid']."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if(!$admin_user_level == 1) { echo "You cannot view this topic!"; } else { $a = (isa($row['uid'])) ? "<font style=\"color:#800000;font-weight:bold;\">ADMIN</font>" : ""; echo "<table border=\"0\" width=\"100%\"cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<tr><td colspan=\"2\" align=\"left\" class=\"forum_header\"><b>".$row['title']."</b>- Posted on: <em>".$row['date']."</em></td></tr>\n"; echo "<tr><td align=\"left\" width=\"15%\" valign=\"top\" class=\"forum_header\">".uid($row['uid'],true)."<br>Post Count: ".post($row['uid'])."</br>".$a."</td>\n"; echo "<td align=\"left\" valign=\"top\" class=\"forum_header\">\n"; echo topic($row['message']); echo "</td>\n"; echo "</tr>\n"; $amount_check = "SELECT * FROM `forum_replies` WHERE `tid`='".$id."'"; $amount_check_res = mysql_query($amount_check) or die(mysql_error()); $amount_count = mysql_num_rows($amount_check_res); $pages = ceil($amount_count/$limit); $previous = ($page-1 <= 0) ? "« Prev" : "<a href=\"./index.php?act=topic&id=".$id."&page=".($page-1)."\">« Prev</a>"; $nextpage = ($page+1 > $pages) ? "Next »" : "<a href=\"./index.php?act=topic&id=".$id."&page=".($page+1)."\">Next »</a>"; echo "<tr><td align=\"right\" colspan=\"2\" class=\"forum_header\">\n"; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href=\"./index.php?act=topic&id=".$id."&page=".$i."\">".$i."</a> "; echo $href; } echo $nextpage; echo "</td></tr>\n"; $select_sql = "SELECT * FROM `forum_replies` WHERE `tid`='".$id."' ORDER BY id ASC LIMIT ".$end.",".$start.""; $select_res = mysql_query($select_sql) or die(mysql_error()); while($rowr = mysql_fetch_assoc($select_res)){ echo "<tr><td colspan=\"2\" align=\"left\" class=\"forum_header\">Posted on: <em>".$rowr['date']."</em></td></tr>\n"; echo "<tr><td align=\"left\" width=\"15%\" valign=\"top\" class=\"forum_header\">".uid($rowr['uid'],true)."<br>Post Count: ".post($rowr['uid'])."</br>".$a."</td>\n"; echo "<td align=\"left\" valign=\"top\" class=\"forum_header\">\n"; echo topic($rowr['message']); if($rowr['edit_time'] > 0){ echo "<tr><td align=\"left\" colspan=\"3\" class=\"forum_header\"><em>Edited at:".date("l jS \of F Y",$rowr['edit_time']) . " at " . date("h:i:s",$rowr['edit_time'])."</em></td></tr>\n"; } $adminz = isa($_SESSION['uid']); //if($adminz == 1){ // echo "<tr><td align=\"right\" colspan=\"2\"><a href=\"index.php?act=mod&act2=topic&id=".$rowr['id']."\" onclick=\"return confirm('Are you sure you want to delete?')\"><img src=\"delete.gif\"></a></td></tr>\n"; //} if($adminz == 1 || $rowr['uid'] == $_SESSION['uid'] || $admin_user_level == 0){ echo "<tr><td align=\"right\" colspan=\"2\"><a href=\"index.php?act=mod&act2=reply&id=".$rowr['id']."\"><img src=\"edit.gif\"></a> <a href=\"index.php?act=test&id=".$rowr['tid']."&reply_id=".$rowr['id']."\"><img src=\"quoteIcon.gif\"></a></td></tr>\n"; } echo "</td>\n"; echo "</tr>\n"; } echo "<tr><td colspan=\"2\" align=\"left\"><a href=\"./index.php?act=reply&id=".$row['id']."\">Reply Now</a></td></tr>\n"; echo "</table>\n"; } } }else { echo "Please view a valid topic!"; }
  2. i bellieve this should do it <?php mysql_connect("database", "username", "password") or die(mysql_error()); mysql_select_db("members") or die(mysql_error()); $sql = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'"); $row = mysql_fetch_array($sql); if ($row['gold'] >= 100) { ////Had error in this line //// $sql = ("UPDATE users SET gold = gold-100, potions = potions+1 WHERE username = '$username'") or die(mysql_error()); $sql = ("UPDATE users SET `gold` = `gold`-100, `potions` = `potions`+1 WHERE `username` = '$username'") or die(mysql_error()); echo "<center>You have bought one health potion.</center>"; }else{ echo "<center>You don't have enough gold. Come back when you getmore.</center>"; } ?> Let us know
  3. try this for now //if(($row2['admin'] == 1) && ($admin_user_level == 0)) if($admin_user_level !== 1) { echo "You cannot view this topic!"; } else { $a = (isa($row['uid'])) ? "<font style { echo "You cannot view this topic!"; } else { .............................. tell me if that dose it
  4. try this it should work for ($x = 0; $x > ($possible_choice_array_totalx-1) ; $x++ ) { $result[$x] = $_POST["$possible_choice_arrayx[$x]"]; echo "$x possible = $possible_choice_arrayx[$x] | $x choicex = $result[$x] <br />"; } Let me know how it goes
  5. There try this <?php $data = array( 0 => array('Name' => 'Test1', 'Street' => 'Test Street', 'City' => 'Test City', 'PostCode' => 'Test Pcode', 'Description' => 'test Description'), 1 => array('Name' => 'Test2', 'Street' => 'Test Street', 'City' => 'Test City', 'PostCode' => 'Test Pcode', 'Description' => 'test Description'), 2 => array('Name' => 'Test3', 'Street' => 'Test Street', 'City' => 'Test City', 'PostCode' => 'Test Pcode', 'Description' => 'test Description'), 3 => array('Name' => 'Test4', 'Street' => 'Test Street', 'City' => 'Test City', 'PostCode' => 'Test Pcode', 'Description' => 'test Description'), 4 => array('Name' => 'Test5', 'Street' => 'Test Street', 'City' => 'Test City', 'PostCode' => 'Test Pcode', 'Description' => 'test Description') ); //Connecting to Database $con = mysql_connect('HOST','USER', 'PASS'); if (!$con) {die('Could not connect: ' . mysql_error());} //SELECT Database mysql_select_db("test", $con); foreach($data as $id=>$row) { $sql = "INSERT INTO site ( `name`, `street`, `city`, `postcode`, `telephone`, `email`, `description`, `image`, `image_type`, `price_month`, `active`, `broker_id`, `operator_id`, `secondary_contact`, `secondary_contact_email`, `postal_contact`, `postal_email`, `postal_telephone` ) VALUES ( '{$row['Name']}', '{$row['Street']}', '{$row['City']}', '{$row['PostCode']}', 'NULL', 'NULL', '{$row['Description']}', 'NULL', 'NULL', 'NULL', '0', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL', 'NULL' )"; } mysql_query($sql) or die("SQL executing error" .mysql_error()); echo "Success"; ?> a few Syntax errors and also tell me if this solved your problem
  6. You have an error in the SQL Syntax Here is the fix try this <? $username = $_COOKIE['ID_my_site']; $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); while($row = mysql_fetch_array($sql)) { $result = mysql_query("SELECT `skill`,`health` FROM users") or die(mysql_error()); $new_a = ($d - ($a * .1)); $new_c = ($a - ($c * .1)); while ((($new_a) && ($new_c)) > '0') { $new_a = ($d - ($new_a * .1)); $new_c = ($d - ($new_c * .1)); } if ($new_a > '0') { $new_a = ($new_a + '10'); } if ($new_c > '0') { $new_c = ($new_c + '0'); } } ?> even i don't understand why do you ren the SELECT health,skill query i don't see you are using it...
  7. beautiful i am happy for you one more thing This is wrong <? echo $_SERVER['www.enaparamus.com'].'/08-09teamphotos/'.$row['picref']; ?> This is right <? echo $_SERVER['HTTP_SERVER'].'/08-09teamphotos/'.$row['picref']; ?> good luck with your project
  8. Beautiful.. well i can explain. The loop runs and echos the Data but... every loop it goes through you keep changing the value. so in the end you are left with one value in the array which is the last one to get set( in your case Row number 2 ) i am happy i could help
  9. Well you had it right but just the wrong order... Try replacing your code with this one( note the changes ) <?php //get the date from the calendar $appointment_date= $_GET['thedate']; echo "appointment date: "; $timestampfromstring=strtotime($appointment_date); $monthfromstring=date("m", $timestampfromstring); $dayfromstring=date("d", $timestampfromstring); $yearfromstring=date("Y", $timestampfromstring); $month=$monthfromstring; $day=$dayfromstring; $year=$yearfromstring; $appointmentblock_time_min=15; //appointment blocks $start_timestamp=mktime(8,0,0,$month,$day,$year); //start time echo $starttimestringthis=date("m-d-y H:i:s", $start_timestamp); $appointments=30; $personId=$_SESSION['person_id']; ///Here we build the array $query="SELECT * FROM calendar"; $result=mysql_query($query); $xx=0; while ($rows=mysql_fetch_assoc($result)) { $scheduledid[$xx]=$rows['id']; $scheduledappointment[$xx]=$rows['appointment']; $scheduledtimestamp[$xx]=$rows['timestamp']; $scheduleduserid[$xx]=$rows['userid']; $xx++; } echo "<table>"; echo "<strong>Patient: ".$_SESSION['patient_lastname'].", ".$_SESSION['patient_firstname']."&nbsp DOB:".$_SESSION['patient_dob']."$nbsp ID:".$_SESSION['person_id']."</strong><br><br>"; //for ($i=0; $i<$appointments; $i++) $i=0; foreach ($scheduledid as $res_id=>$row_id) { if ($i > $appointments) { continue; } echo "<tr>"; echo "<td>"; echo $timestamp = $start_timestamp + (60*$appointmentblock_time_min)*($i); //echo date("H:i", $timestamp); echo "<br>"; // list the appointments that have already been scheduled if ( in_array($timestamp,$scheduledtimestamp)) { echo "</td>"; echo "<td>$scheduledappointment[$res_id]"; echo "</td>"; echo "</tr>"; } else { echo "</td>"; echo "<td id=\"$timestamp\" onmouseover=\"this.style.background='#FECE6E';\" onmouseout=\"this.style.background='#FFF'; \" onclick=\"setAppointment(this.id,$personId,setObj()); \">"; echo "appointment"; echo "</td>"; echo "</tr>"; } $i++; } echo "</table>"; ?> oh and let me know if it worked out for you
  10. which field in the database holds the blue.php??
  11. Ok We'll change a few things one replace while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $diskQuota = $row['disk_quota']; $dirName = $row['dir_name']; $schoolName = $row['school_name']; $id = $row['school_id']; if(!isset($_POST['edit'])) { echo '<tr> <td>'.$schoolName.'</td> <td>'.$dirName.'</td> <td>'.$diskQuota.'</td> </tr>'; } else { echo '<tr> <td><input type="text" name="schoolNameEdit[]" value="'.$schoolName.'" /></td> <td><input type="text" name="dirNameEdit[]" value="'.$dirName.'" /></td> <td><input type="text" name="diskQuotaEdit[]" value="'.$diskQuota.'" /></td> </tr>'; } } with $_x = 0 ; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $diskQuota[$_x] = $row['disk_quota']; $dirName[$_x] = $row['dir_name']; $schoolName[$_x] = $row['school_name']; $id[$_x] = $row['school_id']; if(!isset($_POST['edit'])) { echo '<tr> <td>'.$schoolName[$_x].'</td> <td>'.$dirName[$_x].'</td> <td>'.$diskQuota[$_x].'</td> </tr>'; } else { echo '<tr> <td><input type="text" name="schoolNameEdit[]" value="'.$schoolName[$_x].'" /></td> <td><input type="text" name="dirNameEdit[]" value="'.$dirName[$_x].'" /></td> <td><input type="text" name="diskQuotaEdit[]" value="'.$diskQuota[$_x].'" /></td> </tr>'; } $_x++; } 2: Replace if(isset($_POST['changes'])) { for($i=0;$i<$num_rows;$i++) { $queryUpdate="UPDATE disk_quotas SET school_name='$schNameEdit[$i]', disk_quota=$diskQuotaEdit[$i], dir_name='$dirNameEdit[$i]' WHERE id=$id[$i]"; $resultUpdate=mysql_query($queryUpdate); echo $queryUpdate; } } with if(isset($_POST['changes'])) { $i=0; foreach($id as $row_id) { $queryUpdate="UPDATE disk_quotas SET school_name='$schNameEdit[$i]', disk_quota=$diskQuotaEdit[$i], dir_name='$dirNameEdit[$i]' WHERE id=$row_id"; $resultUpdate=mysql_query($queryUpdate); echo $queryUpdate; $i++; } } I hope that dose it for you please let us know
  12. you might as well post both full files here and we'll try to fix it for you
  13. Change <td><img src="http://<? echo $_SERVER['HTTP_HOST'].'../08-09teamphotos'.$row['picref']; ?>" alt="<?=$row['image_name']?>"></td> To <td><img src="http://<? echo $_SERVER['HTTP_HOST'].'/usag/08-09teamphotos/'.$row['picref']; ?>" alt="<?=$row['image_name']?>"></td> the $_SERVER['HTTP_HOST'] is an equal to www.enateam.com we use it so when the site is moved we don't have to change the links also i checked the source and i didn't see the <td> that suppose to have the IMG tag can you tell me where it's suppose to be?
  14. ok lets start by planning the structure of the site... 1:if you want to make a good portable website you will start by building a file system where the actual processing and the views are separated. now you can go about it a few ways you could setup constants in two files for startus for the menus and main sie text such as how to register, or why sign up for our service, etc... now the same like you did up in the page the same way you should go about it... set all constants / $variables in the processing page, then use them in the view page. 2: the actual process... say you have to say hello in english and spanish... so, you set up two files one called english.php the other called spanish.php. in the english / spanish files you define the values english.php <?php define('HELLO','Hello'); ?> spanish.php <?php define('HELLO','Holla'); ?> index.php the view page <? echo HOLLA; ?> the processing page includes/config.php <? //USER Lang Preference $language = $database_result['lang']; require_once('/lang/'.$language.'.php'); ?> so you see that one way of doing it
  15. Oh yes ok basically you restart the session everytime form1 is loaded you have to check if the session exist before any output to the page and then only if it doe not you should use session_start(); as soon as u use it it will start a new one and then we all know that in a new session u will probably have session id but nothing more
  16. could you send me a sample row from the DB also i want to see what the path that's coming from the Database looks like
  17. the best way to do this is separating the function call from the condition ///$result = $class->_method($var1, $var2 (if(!empty($var3){"," . $var3})); $var3 = ( !empty($var3) ? $var3 : 0 ); ////this will set $var3 to 0 or basically nothing $result = $class->_method($var1, $var2,$var3); inside the function you can set a check like this if($var3) { //action goes here } Hope this helps
  18. ////ok say you want to display an image with the filename of "big_head_guy.jpg" <td><img src="http://<? echo $_SERVER['HTTP_HOST'].'/path_to/image/folder/'.$row['picref']; ?>" alt="<?=$row['image_name']?>"></td> ///was that what you were looking for? ///Or is the image in a folder not accessible from the web server?? ///which in this case you would do this <? //ABSOLUTE PATH... ///linux /home/username/path/to/image/folder... //windows C:\my web folder \............. $path = 'Absolute_path_to/image/folder/'.$row['picref']; $image = file_get_contents($path); ?> <td><? echo $image;?></td> well something like that
  19. ok lets go over it alitle first you can save space by changing $temp = $temp + 1; to-> $temp++; now... lets start by checking for $_GET Vars ////add a condition before the while loop to check for $_GET vars and set the variables... $action = (!empty($_GET['action'])?$_GET['action']:''); $id = (!empty($_GET['id'])?$_GET['id']:''); ///Now check to see if they both exist /// no point to have action without id if (!empty($action) && !empty($id)) { /// a switch to handle action /// you can add more actions to the switch such as set_inactive or disable / enable... switch($action) { case 'view': { ///SELECT QUERY HERE $query = 'SELECT * FORM `table` WHERE `id`='.$id.' LIMIT 1'; $result = mysql_query($query); if ($result) { while ($row = mysql_fetch_assoc($result) ) { ///echo 'TABLE INFORMATION or what ever you want to show'; echo 'Date: ' . $row['date'].'<br>'; echo 'name: ' . $row['name'].'<br>'; ///and so on and on } } else { echo 'Could not get data'; } break; } case 'delete': { ///DELETE QUERY HERE $query = 'DELETE FORM `table` WHERE `id`='.$id.' LIMIT 1'; $result = mysql_query($query); if ($result) { echo 'Record deleted sussesfuly'; } else { echo 'Could not delete data'; } break; break; } default: break; } } $temp = 1; while(!$rs->EOF) { //// now here you will have to add the value to build the link for the row you want to view or delete $id = $rs->Fields("id")->value; $date = $rs->Fields("date1")->value; $time = $rs->Fields("Time1")->value; $Dis = $rs->Fields("table_name")->value; if ($temp1 == 1){ echo "<tr>"; echo "<td><font size='-1'><b>Date</b>"; echo "</td>"; echo "<td><font size='-1'><b>Time</b>"; echo "</td>"; echo "<td><font size='-1'><b>TableName</b>"; echo "</td>"; echo "</tr>"; } echo "<tr>"; echo "<td><font size='-1'>".$date; echo "</td>"; echo "<td><font size='-1'>".$time; echo "</td>"; echo "<td><font size='-1'>".$Dis; echo "</td>"; echo '<td><font size="-1"><a href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=view">View</a>'; echo "</td>"; echo '<td><font size="-1"><a href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete">Delete</a>'; echo "</td>"; echo "</tr>"; $temp++; $rs->MoveNext(); } Let me know how it works out for you... if you need more help i'm here sometimes, but there are more people here. so one of us will help... Good luck
×
×
  • 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.