Jump to content

nhojeinnor

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by nhojeinnor

  1. can i store it using array? like $data = array('id'=>$client); thanks
  2. hi i have this function for select / function select($table, $rows = '*', $where = null, $group = null, $order = null, $limit = null) this is what i do to display the records. $db->select('loan'); $records = $db->getResult(); foreach($records as $row) { $user = $row['id']; //$name = $row['firstname']; //print_r($row); echo $user; ?> the codes is running.but when i want to use WHERE id = $_POST['id']; this is what im doing. $db->select('member')->where(array('id' => $_POST['client'])); an error as occured where in function where is not existing. please help how to use the proper way of using select * $table where id=$id; in array. thanks
  3. because i have many input variables, like $fname $_POST['fname;];,$mname,$lname etc. what i want to do is to create a function that can call those variables w/o seeing it on my form.php? is that possible? thanks.
  4. hi good day, im a little bit confuse. what i want to do is instead of $username = $_POST['username']; is to transform it into OOP? please help me. thanks.
  5. i have a problem with my search pagination. when i click the pages. nothing happen.it just refresh the page. help pls. public function viewSearch($form) { $affid = $form['affid']; $site_id = $form['site_id']; if($affid==""){ $where1 =""; } else { $where1 = "affid = '$affid'" ; } if($site_id==""){ $where2 =""; } elseif($affid=="" || site_id==""){ $where2= "site_id = $site_id"; }else { $where2 ="AND site_id = $site_id"; } $where_condition = $where1 . $where2; $data = array(); if ($affid=="" && $site_id=="") { $count = mysql_query("SELECT * FROM link ORDER BY site_id"); $numrows = mysql_num_rows($count); $rowsperpage = 30; $totalpages = ceil($numrows / $rowsperpage); if (isset($_GET['page']) && is_numeric($_GET['page'])) { $currentpage = (int) $_GET['page']; } else { $currentpage = 1; } if ($currentpage > $totalpages) { $currentpage = $totalpages; } if ($currentpage < 1) { $currentpage = 1; } $offset = ($currentpage - 1) * $rowsperpage; $data = array(); $sql = "SELECT * FROM link ORDER BY site_id LIMIT $offset, $rowsperpage"; $result = mysql_query($sql) or die(mysql_error()); while(($rows = mysql_fetch_array($result))) { $data[] = $rows; } echo ' <b>Pages:</b> '; $range = 4; if ($currentpage > 1) { echo " <a href='{$_SERVER['PHP_SELF']}?page=1'>First</a> "; $prevpage = $currentpage - 1; echo " <a href='{$_SERVER['PHP_SELF']}?page=$prevpage'>Prev</a> "; } for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { if (($x > 0) && ($x <= $totalpages)) { if ($x == $currentpage) { echo " [<b>$x</b>] "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?page=$x'>$x</a> "; } } } if ($currentpage != $totalpages) { $nextpage = $currentpage + 1; echo " <a href='{$_SERVER['PHP_SELF']}?page=$nextpage'>Next</a> "; echo " <a href='{$_SERVER['PHP_SELF']}?page=$totalpages'>Last</a> <br /><br /><br />"; } } else { $count = mysql_query("SELECT * FROM link WHERE $where_condition ORDER BY site_id"); $numrows = mysql_num_rows($count); $rowsperpage = 30; $totalpages = ceil($numrows / $rowsperpage); if (isset($_GET['page']) && is_numeric($_GET['page'])) { $currentpage = (int) $_GET['page']; } else { $currentpage = 1; } if ($currentpage > $totalpages) { $currentpage = $totalpages; } if ($currentpage < 1) { $currentpage = 1; } $offset = ($currentpage - 1) * $rowsperpage; $data = array(); $sql = "SELECT * FROM link WHERE $where_condition ORDER BY site_id LIMIT $offset, $rowsperpage"; $result = mysql_query($sql) or die(mysql_error()); while(($rows = mysql_fetch_array($result))) { $data[] = $rows; } echo ' <b>Pages:</b> '; $range = 3; if ($currentpage > 1) { echo " <a href='?page=1'>First</a> "; $prevpage = $currentpage - 1; echo " <a href='?page=$prevpage'>Prev</a> "; } for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { if (($x > 0) && ($x <= $totalpages)) { if ($x == $currentpage) { echo " [<b>$x</b>] "; } else { echo " <a href='?page=$x'>$x</a> "; } } } if ($currentpage != $totalpages) { $nextpage = $currentpage + 1; echo " <a href='?page=$nextpage'>Next</a> "; echo " <a href='?page=$totalpages'>Last</a> <br /><br /><br />"; } }
  6. else { //max displayed per page $per_pages = 30; //get start variable $starts = $_GET['starts']; //count max pages $max_pages = $counts / $per_pages; if (!$starts) $starts = 0; $counts = mysql_num_rows(mysql_query("SELECT * FROM link WHERE $where_condition ORDER BY site_id")); $sql = "SELECT * FROM link WHERE $where_condition ORDER BY site_id LIMIT $starts, $per_pages"; $results = mysql_query($sql) or die(mysql_error()); while(($rows = mysql_fetch_array($results))) { $data[] = $rows; } $prev = $starts - $per_pages; $next = $starts + $per_pages; //show prev button if (!($starts<=0)) echo "<a href='?starts=$prev'>Prev</a> "; //set variable for first page $i=1; for ($x=0;$x<$counts;$x=$x+$per_pages) { if ($starts!=$x) echo " <a href='?starts=$x'>$i</a> "; else echo " <a href='?starts=$x'>[$i]</a> "; $i++; } //show next button if (!($starts>=$counts-$per_pages)) echo "<a href='?starts=$next'>Next</a> "; } this is my else part.. what i want is when it execute.. and the pages will pages is shown.. like 1 2 3 4 5 , when i click 2, i want the page to be turn on page 2. but what is does is redirect to my IF condition. this is the part. public function viewSearch($form) { $affid = $form['affid']; $site_id = $form['site_id']; if($affid==""){ $where1 =""; } else { $where1 = "affid = '$affid'" ; } if($site_id==""){ $where2 =""; } elseif($affid=="" || site_id==""){ $where2= "site_id = $site_id"; }else { $where2 ="AND site_id = $site_id"; } $where_condition = $where1 . $where2; $data = array(); if ($affid=="" && $site_id=="") { //max displayed per page $per_page = 30; //get start variable $start = $_GET['start']; //count max pages $max_pages = $record_count / $per_page; if (!$start) $start = 0; $count = mysql_num_rows(mysql_query("SELECT * FROM link ORDER BY site_id")); $sql = "SELECT * FROM link ORDER BY site_id LIMIT $start, $per_page"; $result = mysql_query($sql) or die(mysql_error()); while(($rows = mysql_fetch_array($result))) { $data[] = $rows; } $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='{$_SERVER['PHP_SELF']}?start=$prev'>Prev</a> "; //set variable for first page $i=1; for ($x=0;$x<$count;$x=$x+$per_page) { if ($start!=$x) echo " <a href='{$_SERVER['PHP_SELF']}?start=$x'>$i</a> "; else echo " <a href='{$_SERVER['PHP_SELF']}?start=$x'>[$i]</a> "; $i++; } //show next button if (!($start>=$count-$per_page)) echo "<a href='{$_SERVER['PHP_SELF']}?start=$next'>Next</a> "; }
  7. str_replace('$quote',&#39,'$var'); here try this. this should work..
  8. try youtube. theres a tutorial there for uploading codes.
  9. <?php ob_start(); session_start(); if(!(isset($_SESSION['name'])))//try to change the name. the same as ur session login. header("Location:index.php"); ?> try to create a session.php then include "session.php";
  10. $insert = "INSERT INTO members (username, password,Finame, Secname, email) VALUES ('".$_POST['username']."', '".$_POST['pass']."', '".$_POST['Finame']."', '".$_POST['secname']."', '".$_POST['email']."')"; $add_members = mysql_query($insert); try to put ur query on a if else condition together with your $_POST['submit'] value. if($submit){//some input tex} else{ur query} or if(submit){ur query} else{//error message}
  11. use this <meta http-equiv="refresh" content="1;url=blablalba"> it will reload the page every 1 second.
  12. function __autoload($class_name) { require_once $class_name.".class.php"; } is ".class.php"? try "class.php"
  13. <?php //ur post value here. $username=$_POST['username'] ?> <tr><td><font face="neuropol" size="2">*Username:</font></td><td><input type="text" name ="username" size="21" value="<?php echo $username ?>"></td> <?php if(isset($_POST['submit']) and !empty($_POST['username'])) { include "connect.php"; $queryID = mysql_query("SELECT username FROM cus_reg WHERE username ='$username'"); $countRecord = mysql_num_rows($queryID); if($countRecord != 0) { die("<td><font color=#990000 size=-1>Username already Exist.<meta http-equiv='refresh' content='2,URL=customer_reg.php'></font></td>"); $adderror.=""; } else { echo""; } } if(isset($_POST['submit']) and empty($username)) { echo "<td><font color=#990000 size=-1 face=neuropol>*Enter First Name.</font></td>"; $adderror.="error"; } elseif(isset($_POST['submit']) and strlen($username) < 5) { echo "<td><font color=#990000 size=-1 face=neuropol>*Minimum of 5 Characters Only.</font></td>"; $adderror.="error"; } else { echo""; } ?> </tr> <tr><td><br><font face="neuropol" size="2">*Password:</font></td><td><br><input type="password" name ="password" size="21"></td> <?php if(isset($_POST['submit']) and empty($password)) { echo "<td><br><font color=#990000 size=-1 face=neuropol>*Enter Password.</font></td>"; $adderror.="error"; } elseif(isset($_POST['submit']) and strlen($password) < 7) { echo "<td><br><font color=#990000 size=-1 face=neuropol>*Minimum of 7 Characters Only.</font></td>"; $adderror.="error"; } else if(isset($_POST['submit']) and ($password != $repeat)) { echo "<td><br><font color=#990000 size=-1 face=neuropol>*Password did not Match.</font></td>"; $adderror.="error"; } else echo ""; ?> </tr> </tr> <tr><td><br><font face='neuropol' size='2'>*Repeat Password:</font></td> <td><br><font face='neuropol' size='2'><input type="password" name ="repeat" size="21"></font></td> <?php if(isset($_POST['submit']) and empty($repeat)) { echo"<td><br><font color=#990000 size=-1 face=neuropol>*Enter Password</font></td>"; $adderror.="error"; } else if(isset($_POST['submit']) and ($password != $repeat)) { echo "<td><br><font color=#990000 size=-1 face=neuropol>*Password did not Match.</font></td>"; $adderror.="error"; } else { echo ""; } ?> </tr> <tr><td><br><br></td><td><br><input type="submit" value="Create Account" name="submit"><br><br><a href ="tellerpage.php"><font face=neuropol size=2>Back</font></a></td></tr> <?php if((isset($_POST['submit'])) and empty($adderror)) { include "connect.php"; $queryreg = mysql_query (" //your mysql query here. INSERT blablabla. "); mysql_error(); die("Registration Successful,<br>") } else if(!empty($adderror)) { echo"<center><br>Please FIll in The Required Fields</center><br><br><br>"; $adderror .= "error"; } ?> here's an example.. try this one..
  14. pls help me with my codes. i am calling this function to a new php file. what i want to do is when the ELSE CONDITION execute. the pages will display and when i click the pages. prev12345next will direct to next page. but the problem is.. it redirects to my IF CONDITION. where the the IF CONDITION will display the total output of the data. when no input value on the searchbox.. and paginates the records.. pls help.. tnx.. public function viewSearch($form) { $affid = $form['affid']; $site_id = $form['site_id']; if($affid==""){ $where1 =""; } else { $where1 = "affid = '$affid'" ; } if($site_id==""){ $where2 =""; } elseif($affid=="" || site_id==""){ $where2= "site_id = $site_id"; }else { $where2 ="AND site_id = $site_id"; } $where_condition = $where1 . $where2; $data = array(); if ($affid=="" && $site_id=="") { //max displayed per page $per_page = 30; //get start variable $start = $_GET['start']; //count max pages $max_pages = $record_count / $per_page; if (!$start) $start = 0; $count = mysql_num_rows(mysql_query("SELECT * FROM link ORDER BY site_id")); $sql = "SELECT * FROM link ORDER BY site_id LIMIT $start, $per_page"; $result = mysql_query($sql) or die(mysql_error()); while(($rows = mysql_fetch_array($result))) { $data[] = $rows; } $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='{$_SERVER['PHP_SELF']}?start=$prev'>Prev</a> "; //set variable for first page $i=1; for ($x=0;$x<$count;$x=$x+$per_page) { if ($start!=$x) echo " <a href='{$_SERVER['PHP_SELF']}?start=$x'>$i</a> "; else echo " <a href='{$_SERVER['PHP_SELF']}?start=$x'>[$i]</a> "; $i++; } //show next button if (!($start>=$count-$per_page)) echo "<a href='{$_SERVER['PHP_SELF']}?start=$next'>Next</a> "; } else { //max displayed per page $per_pages = 5; //get start variable $starts = $_GET['starts']; //count max pages $max_pages = $counts / $per_pages; if (!$starts) $starts = 0; $counts = mysql_num_rows(mysql_query("SELECT * FROM link WHERE $where_condition ORDER BY site_id")); $sql = "SELECT * FROM link WHERE $where_condition ORDER BY site_id LIMIT $starts, $per_pages"; $results = mysql_query($sql) or die(mysql_error()); while(($rows = mysql_fetch_array($results))) { $data[] = $rows; } $prev = $starts - $per_pages; $next = $starts + $per_pages; //show prev button if (!($starts<=0)) echo "<a href=\"?starts=$prev\">Prev</a> "; //set variable for first page $i=1; for ($x=0;$x<$counts;$x=$x+$per_pages) { if ($starts!=$x) echo " <a href=\"?starts=$x\">$i</a> "; else echo " <a href=\"?starts=$x\">[$i]</a> "; $i++; } //show next button if (!($starts>=$counts-$per_pages)) echo "<a href=\"?starts=$next\">Next</a> "; } return $data; }
  15. ive figured out myself.. anyone wants to know.. just post here.
  16. public function viewLinks() { $sql = "SELECT * FROM link"; $result = mysql_query($sql) or die(mysql_error()); while($rows=mysql_fetch_array($result)) { $siteid = $rows['site_id']; $affid = $rows['affid']; $sales_type = $rows['sales_type']; $link = $rows['link']; echo $link; } } } what i want to do is to display those records from another php file. or to a new form. but how? pls help. tnx
  17. pls help me.. i am using OOP in PHP and codeigniter as my framework. my problem is that my system does not support other BROWSER while on server only FIREFOX... while on LOCALHOST. it runs on different browsers.. here's the situation.. on FIREFOX and UPLOADED TO SERVER. when i LOGIN as a USER.. it automatically redirect the user on the USER PAGE... while on OTHER BROWSERS(IE,SAFARI,OPERA).. when i LOGIN as USER.. it ONLY REFRESHES the PAGE... while ON LOCALHOST.. it runs SMOOTHLY on DIFFERENT BROWSERS.. tnx in advanced..
  18. pls help me.. i am using OOP in PHP and codeigniter as my framework. my problem is that my system does not support other BROWSER while on server only FIREFOX... while on LOCALHOST. it runs on different browsers.. here's the situation.. on FIREFOX and SERVER. when i LOGIN as a USER.. it automatically redirect the user on the USER PAGE... while on OTHER BROWSERS(IE,SAFARI,OPERA).. when i LOGIN as USER.. it ONLY REFRESHES the PAGE... while ON LOCALHOST.. it runs SMOOTHLY... u said that its on my PHP.INI.. can u guide me?? tnx in advanced..
  19. so will i post my php.ini codes here?? or the whole system codes? firefox is the only browser that runs my system on server.. tnx
  20. hi everyone help me pls. i am using zend as my frame work. ive run my system on local using diff browser like IE,safari,Opera. and ive login on it. and it works. but when i uploaded it on a server. nothing happens. it just refresh the page. and it only works on firefox. help me pls. tnx
  21. can sumone help me in php coz when i run my website on localhost with firefox,safari,opera IE. and login. it works. while when i uploaded it thru net. nothing happens when i log in. tnx
×
×
  • 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.