Jump to content

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. $CanoNi = $_SERVER['REQUEST_URI']; $CheckCanoNi = explode('?',$CanoNi); if($CheckCanoNi[1] != '' && ($_REQUEST['p'] == '0' || $_REQUEST['p']=="") ){ $Conictag = "http://".$_SERVER[HTTP_HOST].$CheckCanoNi[0]; echo '<link rel="canonical" href="'.$Conictag.'"/>'; } if($CheckCanoNi[1] != '' && $_REQUEST['reset'] == '1' && ($_REQUEST['p'] == '1' || $_REQUEST['p']=="")){ $Conictag = "http://".$_SERVER[HTTP_HOST].$CheckCanoNi[0]; echo '<link rel="canonical" href="'.$Conictag.'"/>'; } I'm trying to extend someone else's code that sets the canonical tags but please could someone break down what these if statements are doing please? I can't for the life of me seem to set the canonical tag on pages with query parameters. && $_REQUEST['reset'] == '1' [/size]seems to set the canonical tag on ?=reset URL's but it doesn't if I change the reset to perpage for example. Thanks in advance.
  2. Hello, I am stuck in one of my application module. I have to set multiple delete option in my application. I have used the below code. The designing is perfectly fine. All what i want to add multiple delete options in it. Below is the code which i have tried out: <html> <head> <title>Strad Hosting Limited -Web Hosting</title> <script language="javascript"> function validate() { var chks = document.getElementsByName('checkbox[]'); var hasChecked = false; for (var i = 0; i < chks.length; i++) { if (chks[i].checked) { hasChecked = true; break; } } if (hasChecked == false) { alert("Please select at least one."); return false; } return true; } </script> </head> <body > <?php $con=mysqli_connect("localhost","stradsol","D#v,b5TnQ!D!","stradsol_sales"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM Persons"); echo "<form name='form1' method='post' action='' onSubmit='return validate();'>"; echo "<table border='1' style=' background-color: white;'> <tr> <th></th> <th>id</th> <th style='padding-left: 11px;'>Lead Generated Date </th> <th>name</th> <th>email</th> <th>contacts</th> <th>requirement</th> <th style='display:none;'>Company name</th> <th style='display:none;'>Address</th> <th>Next Follow-Up date</th> <th>Final_Details</th> <th style='display:none;'>Status</th> <th style='padding-left: 12px; display:none;'>Lead Closed Date</th> <th>EDIT</th> <th>Follow-up History</th> <th>Add Follow-up</th> <th>Delete Record</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td><input name='checkbox[]' type='checkbox' id='checkbox[]' value='".$rows['id']."'></td>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['date'] . "</td>"; echo "<td><a href='config_info.php?id=" . $row['id'] . "'>".$row['name']."</a></td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['contacts'] . "</td>"; echo "<td>" . $row['requirement'] . "</td>"; echo "<td style='display:none;'>" . $row['company_name'] . "</td>"; echo "<td style='display:none;'>" . $row['address'] . "</td>"; echo "<td>" . $row['startdate'] . "</td>"; echo "<td>" . $row['final_details'] . "</td>"; echo "<td style='display:none;'>" . $row['status'] . "</td>"; echo "<td style='display:none;'>" . $row['lead_close'] . "</td>"; echo "<td><a href='edit_eg1.php?id=" . $row['id'] . "'>Edit</a></td>"; echo "<td><a href='Follow_history.php?id=" . $row['id'] . "'>Follow_history</a></td>"; echo "<td><a href='add_follow.php?id=" . $row['id'] . "'>Followup</a></td>"; echo "<td><a href='delete.php?id=" . $row['id'] . "'>Delete</a></td>"; echo "</tr>"; } echo "<tr><td><input name='delete' type='submit' id='delete' value='Delete'></td></tr>"; $count=mysqli_num_rows($result); if(isset($_POST['delete'])){ for($i=0;$i<count($_POST['checkbox']);$i++){ $del_id=$_POST['checkbox'][$i]; $sql = "DELETE FROM Persons WHERE id='$del_id'"; echo $sql; $result2 = mysqli_query($con,$sql); } // if successful redirect to delete_multiple.php if($result2) { echo "<meta http-equiv=\"refresh\" content=\"0;URL=edit_table_del.php\">"; } } mysqli_close($con); echo "</table>"; echo "</form>"; ?> <br><br> <a href="index2.php">[ Back To Home ]</a> </body> </html> I am stuck, the query is not working i thing. Dont know what i am missing. It will be greatful is some one can help me out with this.
  3. We are a Silicon Valley based startup and 30-60 days away from launch. We are seeking a partner and outstanding web developer to be responsible for developing and implementing innovative and secure web application for our eCommerce business. The person would work closely with our Marketing, Sales, Engineering and IT members to develop specifications and make recommendations on the use of new and emerging technologies and then implement those recommendations. Design, Programming, and database administration are all elements of this position. This person must have following experience and skills: - HTML5, XHTML, CSS3, PHP, and JavaScript, AJAX, jQuery, responsive frameworks and other technologies - command of web standards, CSS-layouts, DOM scripting, cross-browser compatibility & browser degradation strategies - working with the various JavaScript and PHP libraries - understanding of dynamic or active web content and the use of CGI, Perl, Java, XML and JSON - experience with SQL database (MySQL) - little understanding of Unix/Linux system and Apache web-server administration - experience working with Google Webmaster Tools, Google Analytics, and Google Custom Search - develop responsive and mobile websites
  4. Hello, I have used Single Translation Table Approach to make multilanguage site in PHP. You may see here The current index page is not working. My objective is to have one example to use these tables and display one working page. For example: It should work like this by using those tables (app_language, app_product, app_translation, app_translation_entry). What i did so far on my home page: <!DOCTYPE html> <?php session_start(); $_SESSION['current_language'] = "fr"; $con = mysql_connect("localhost","worksite",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("worksite", $con); ?> <?php // handle language selection if(in_array($_GET['lang'], $languages)) { $_SESSION['lang'] = $_GET['lang']; } // define LANG constant only if it exists in $languages array, otherwise default to EN define('LANG', in_array($_SESSION['lang'], $languages) ? $_SESSION['lang'] : 'fr'); define('LANG', in_array($_SESSION['lang'], $languages) ? $_SESSION['lang'] : 'en'); // display language options foreach($languages as $language) { echo '<a href="?lang='.$language.'">'.$language.'</a>'; } $sql = "SELECT p.*, l.name as language_name, te.field_text as title FROM `app_product` p INNER JOIN `app_translation_entry` te ON p.title = te.translation_id INNER JOIN `app_language` l ON te.language_code = l.code WHERE p.id = 1"; if($result = mysql_query($sql)){ while($row = mysql_fetch_assoc($result)){ echo "Language (".$row["language_name"]."): ".$row["title"]."<br>"; } } // Retrieve appropriate title according to the chosen language in the system $sql = "SELECT p.*, l.name as language_name, te.field_text as title FROM `app_product` p INNER JOIN `app_translation_entry` te ON p.title = te.translation_id INNER JOIN `app_language` l ON te.language_code = l.code WHERE p.id = 1 AND te.language_code = '".$_SESSION['current_language']."'"; if($result = mysql_query($sql)){ if($row = mysql_fetch_assoc($result)){ echo "Current Language: ".$row["title"]; } } ?> </body> </html> You may edit this file as you wish but it should be working as per example link (demo). I want to build static website from above approach. Thanks in advanced for your time and input.
  5. Hi, I am a ZCE in PHP5. You can visit my profile at http://www.freelancer.com/u/phpopensource.html Thanks
  6. Hello. I have a strange error T_String, because it was not there until I changed my server. I updated my details, but returns: Parse error: syntax error, unexpected T_STRING in /usr/home/motorra/public_html/login/db_connect_close.php on line 4 1. <?php 2. $link = mysql_connect("localhost", "USER", "PASS") 3. // Close connection 4. mysql_close($link); 5. ?>
  7. Hi Folks I have been trying to get a sql query to pass between pages in moodle 2.x. Moodle uses object orientation. The problem I have is the processed query return $DB->get_records($sql) will not pass back to index.php without a horrible hack. First: There are two files, index.php and lib.php (has functions in it) index.php calls lib.php with this line: $users = get_mentor_users($fromdate, $todate); lib.php executes this function: function get_mentor_users($fromdate = 0, $todate = 0){ $sql = "SELECT DISTINCT u.id , u.firstname, u.lastname FROM mdl_role_assignments ra, mdl_user u, mdl_course c, mdl_context cxt WHERE ra.userid = u.id AND ra.contextid = cxt.id AND cxt.contextlevel =50 AND ( roleid =3 ) AND u.firstname LIKE '%mentor%'"; if($datesql = generate_sql_range($fromdate, $todate, ', mdl_grade_grades.timemodified')) { $sql .= " AND $datesql"; } return $DB->get_records_sql($sql); } Now for the perplexing part. index.php throws out a blank screen. I rewrote this function to pass the sql string from lib.php to index.php then for index.php to do the sql query locally and then it works fine. Like so: index.php $sql2 = get_mentor_users($fromdate, $todate); $users = array(); $users = $DB->get_records_sql($sql2); But then accessing the array gets kinda ugly. Then in lib.php only the unprocessed sql string is returned back to index.php. function get_mentor_users($fromdate = 0, $todate = 0){ $sql = "SELECT DISTINCT u.id , u.firstname, u.lastname FROM mdl_role_assignments ra, mdl_user u, mdl_course c, mdl_context cxt WHERE ra.userid = u.id AND ra.contextid = cxt.id AND cxt.contextlevel =50 AND ( roleid =3 ) AND u.firstname LIKE '%mentor%'"; if($datesql = generate_sql_range($fromdate, $todate, ', mdl_grade_grades.timemodified')) { $sql .= " AND $datesql"; } return $sql; } The output of the array below: Array ( [12] => stdClass Object ( [id] => 12 [firstname] => Mentor Peter [lastname] => Swananipoel [totalmarked] => [totalcommarked] => 0 [totalsummarked] => 0 [markedcompetent] => 0 [markedincompetent] => 0 ) [14] => stdClass Object ( [id] => 14 [firstname] => Mentor Garfield [lastname] => Robertson [totalmarked] => [totalcommarked] => 0 [totalsummarked] => 0 [markedcompetent] => 0 [markedincompetent] => 0 ) [15] => stdClass Object ( [id] => 15 [firstname] => Mentor Bert [lastname] => Cat [totalmarked] => [totalcommarked] => 0 [totalsummarked] => 0 [markedcompetent] => 0 [markedincompetent] => 0 ) ) How can I pass this array between pages without the shenanigans? Thanks
  8. I have created the chat system. I want to reload the div so that it can have the effect of instant messaging.I am very new to php. Can anyone help me? Attached is the php file of the display messagees page:( conversations.php
  9. This is the function I am currently working with... /** * Retrieve search query text * * @return string */ public function getQueryText() { if (!isset($this->_queryText)) { $this->_queryText = $this->_getRequest()->getParam($this->getQueryParamName()); $noescape = preg_replace("/%u([0-9a-f]{3,4})/i","\\1;",urldecode($this->_queryText)); if ($this->_queryText === null) { $this->_queryText = ''; } else { /* @var $stringHelper Mage_Core_Helper_String */ $stringHelper = Mage::helper('core/string'); $this->_queryText = is_array($this->_queryText) ? '' : $stringHelper->cleanString(trim($this->_queryText)); echo '<span style="display: none;">'; echo '<pre>'; var_dump ( $noescape ); echo '</pre>'; echo '</span>'; $maxQueryLength = $this->getMaxQueryLength(); if ($maxQueryLength !== '' && $stringHelper->strlen($this->_queryText) > $maxQueryLength) { $this->_queryText = $stringHelper->substr($this->_queryText, 0, $maxQueryLength); $this->_isMaxLength = true; } } } return $this->_queryText; } I can echo what I need to output in this function with $noescape however I need to modify return $this->_queryText; to include the preg_replace and rawurldecode from $noescape. Please could someone be kind enough to advise of the correct syntax/way of handling this? I did post this on StackOverflow but had no response as of yet. Thanks in advance.
  10. hello i have a dropdown box where i have populated values from the sql database. no when i select a value from the drop dopwn, i want to display all the records related to that value under the dropdown. here is my code <?php $select=FALSE; require_once ("configFile.php"); $result=mysql_query("SELECT Registration_No FROM vehicle_master "); if($result == FALSE) { die(mysql_error()); // TODO: better error handling } //populate dropdown with vehicles //echo "<label>Select vehicle number : </label>"; //echo "<select name='vehicles'>"; //while ($row = mysql_fetch_array($result)) //{ // echo "<option value='numberPlate'>" . $row['Registration_No'] . "</option>"; //} //echo "</select>"; //echo "<br><br>"; // $select=isset($_POST['vehicles']); ?> <form id="form1" name="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <?php echo "<select name='select'>"; $list=mysql_query("SELECT * from vehicle_master"); while($row_list=mysql_fetch_assoc($list)) { ?> <option value="<?php echo $row_list['Registration_No']; ?>" <?php if($row_list['Registration_No']==$select) { echo "selected"; } ?>> <?php echo $row_list['Registration_No']; ?> </option> <?php } ?> </select> <input type="submit" name="Submit" value="select" /> </form> <br> <?php if (isset($_POST['SELECT'])) { $Registration_Nos=mysql_real_escape_string($_POST['SELECT']); $result=mysql_query("SELECT * FROM vehicle_master WHERE Registration_No='".$Registration_Nos."'"); while ($row=mysql_fetch_assoc($result)) { echo "".$row['Emergency_Contact_1'].""; } }?>. can anyone tell me where am i going wrong ? control.php
  11. Hello, i need some help i dont know how to send to $message,$naam,$tel <?php } else // the user has submitted the form { // Check if the "from" input field is filled out if (isset($_POST["from"])) { // Check if "from" email address is valid $mailcheck = spamcheck($_POST["from"]); if ($mailcheck==FALSE) { echo "Invalid input"; } else { $from = $_POST["from"]; // sender $subject = $_POST["subject"]; $message = $_POST["message"]; $naam = $_POST["naam"]; $tel = $_POST["tel"]; // message lines should not exceed 70 characters (PHP rule), so wrap it $message = wordwrap($message, 70) ; // send mail mail("example@gmail.com",$subject,$message,"From: $from\n"); echo "u wordt zo spoedig mogelijk geholpen"; } } } ?> What do i need to change ? Thanks.
  12. Hi I want to include a php file (basically my personal header) above the phpbb forum header. The file where I am inserting the code is "page_header.php" which is located in the includes folder. (file attached in this post). If I insert the following code: $root = realpath($_SERVER["DOCUMENT_ROOT"]); include "$root/top.php"; I get what I want but the font color of all the topics posted in the forum change from black to white (making it unreadable). How can I rectify this conflict and how is it happening? Thanks (I am new to php) page_header.php
  13. Hi all, I was wondering if you can help me with an issue I am having with my website. I am very new to php/html/css and mysql so I know very little. I have an order form on my website which when filled in send data to my database. I then have an admin page on my site which shows the data in the database. However, I need the data to be stored in a table with a row containing the column name and then each row showing the actual data underneath. Would like it in a grid sort of format. My current code is: <!doctype html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <link href="css/reset.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container2"> <div id="adminpanel"> Admin Page <div id="showorders"><u>Orders</u></div> <?php include('connection.php'); $result = mysql_query("SELECT * FROM orderform"); while($row = mysql_fetch_array($result)) { echo "<span style='color: #333; width: 200px; height: 200px; padding: 1px; border: 1px solid #ff9900;'>" . $row['product'] . " " . $row['productcomments'] . " " . $row['name'] . " " . $row['address'] . " " . $row['age'] . " " . $row['delivery'] . "</span>" ; echo "<br>"; } ?> <div id="showreviews"><u>Reviews</u></div> <?php $result = mysql_query("SELECT * FROM reviewform"); while($row = mysql_fetch_array($result)) { echo "<span style='color: #333; width: 200px; height: 200px; padding: 5px; border: 1px solid #ff9900;'>" . $row['name'] . " " . $row['product'] . " " . $row['comment'] . "</span>" ; echo "<br>"; echo $row['name'] . " " . $row['product'] . " " . $row['comment'] ; echo "<br>"; } ?> </div> </div> </body> This code puts a border around each row but doesnt seperate each column and doesnt show a header. Ultimately, I am going to want to sort each order by different criteria e.g alphabetical, date ordered, product type. All help is really appreciated as I am really pushed for time and a complete beginner. Thanks Jonathan
  14. //CHECK TO SEE IF TABLE ALREADY EXISTS TO THE DATE if($TABLE_NAME == $date){ // IF EXISTS THEN DROP THE TABLE echo 'THIS DATE ALREADY EXISTS <br>'; $drop_table = "DROP TABLE` " .$date."`"; mysql_query($drop_table); echo '<h4>THE TABLE HAS BEEN DROPPED</h4><h5>NOW SELECT THE FILE YOU WANT TO CREATE</h5>'; } else{ // CREATE THE NEW TABLE $create_table = "CREATE TABLE `".$date."` ( `entry_id` int(11) NOT NULL, `transaction_id` varchar(55) NOT NULL, `name` varchar(255) character set latin1 default NULL, `price` varchar(11) character set latin1 default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; mysql_query($create_table); echo 'NEW TABLE HAS BEEN CREATED PLEASE MOVE TO NEXT STEP'; } $run_q = mysql_query($create_table); $return = '<h4>FILE THAT YOU SELECTED:</h4>' . $_FILES['file']['name']; $file = $_FILES['file']['tmp_name']; $handle = fopen($file,"r"); while(($fileop = fgetcsv($handle,1000,",")) !== false){ $name = $fileop[0]; $price = $fileop[1]; $t_id = $fileop[2]; $ship_method = ''; $cc = ''; $address = ''; $city = ''; $state = ''; $cc = ''; $email = ''; $p_name = ''; $p_quantity = ''; $total = ''; $id = ''; $date = ''; } I can't seem to get the DROP TABLE query to execute through PHP. It is not a multiple query or anything that would create confusion, and when imputed into SQL directly fire correctly. Any suggestions ?
  15. I have a form, that is a chat apps am building for project. Now everything seems to be working fine to the best of my ability. I want to submit the data from the form into my php script without any form of reload. That means i don't want redirection, to the action page and back to the chat page. What i want is for the page to submit the form at the background. And i know i need ajax to this bt i cnt get it right. Here is my form <form method="post" id='chatbox' action="reply.php"> <input type="text" id="text" name="adchat"/> <input type='hidden' id='user_id' name='id' value='1'> <input type='hidden' id='user_name' name='id' value='Ben'> <input type='submit' id='submit' name='chat' value='send'></form> What i need is an ajax code to submit d variable to the reply.php scrit and maybe a message to display when the form it been submitted say something like (sending...). Thanks for assiting. Pls i don't know anything when it comes to AJAX. Please forgive me and help me. Don't borther about displaying the user input just make it submit it to the php script. Thank you once again.
  16. shannel

    help

    Hi all, wondering if you have any ideas about this. I am trying to do an insert function only if the username exists . I am able to do this successfully BUT i'm having a problem doing the insert only for the ID associated with the username. So it would check if "Susan Bingam" is in the staff_details table, then grabs the ID associated with Susan and adds her into the password table using the password she entered into the html form it should record this ID in the password table too . I would really appreciate your help. Thank you Below is the code I have so far. $url_id = mysql_real_escape_string($_GET['id']); $uname = $_POST['uname']; $check = "(SELECT * FROM staff_details WHERE user_Name = '$uname' && id = '$url_id')"; //echo ($check); $checkResult = mysql_query($check); //$checkRows = mysql_num_rows($checkResult); echo($uname); if (mysql_num_rows($checkResult) > 0)//isset($checkRows)))// && ($checkRows == 0)) { $password = $_POST['password']; $sql2 = "INSERT INTO `password` (ID,password,registration_date) VALUES ('$url_id','$password','') "; $query2 = mysql_query($sql2); print("SUCCESSFULL."); } else { print("Error , you need to be a member of staff to sign up."); }
  17. I got a movie search website but when I search something it says 404 page not found. The site is working under a framework called code igniter. Here is the back-end code of search engine: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Search extends CI_Controller { function __construct() { parent::__construct(); } public function index($extra=array()) { $q = $this->input->get('q'); if (!empty($q)) { redirect('search/' . $q); } redirect(); } public function do_search() { $this->load->model('movies'); $this->load->model('ssearch'); $search_string = $this->uri->segment(2); $data['main_menubar']['categories'] = $this->movies->get_all_categories(); $data['search']['results'] = $this->ssearch->search_for_movies($search_string); echo $this->load->view('includes/header', (isset($data['header']) ? $data['header'] : ''), true); echo $this->load->view('includes/main_menubar', (isset($data['main_menubar']) ? $data['main_menubar'] : ''), true); echo $this->load->view('search', (isset($data['search']) ? $data['search'] : ''), true); echo $this->load->view('includes/footer', (isset($data['footer']) ? $data['footer'] : ''), true); } } And the front-end code: <div class="content_segment recentMovies clearfix"> <div class="segment_title clearfix"> Search: <?php echo urldecode($this->uri->segment(2)); ?> </div> <!-- segment_title --> <div class="inner_padding clearfix"> <div class="horisontal_movie_list clearfix"> <?php if(empty($results)) : ?> <p>No movies found.</p> <?php endif; ?> <ul> <?php if(!empty($results)): ?> <?php foreach($results as $movie) : ?> <?php $categories = explode(',', $movie['categories']); $cat_ids = explode(',', $movie['categories_id']); $movie['categories'] = ""; for ($i=0; $i < count($categories); ++$i) { $movie['categories'] .= '<a href="'.site_url('view/category/'. $cat_ids[$i]).'">'.$categories[$i].'</a>, '; } $movie['categories'] = substr($movie['categories'], 0, -2); ?> <li> <a href="<?php echo site_url('view/movie/'. $movie['id']); ?>"> <div class="imageWrapper"> <img src="<?php echo base_url() . 'img/movie_covers/' . $movie['cover_image']; ?>" alt="No cover!" /> </div> </a> <div class="information"> <h4 class="title"> <?php if($movie['favorite'] == 1) : ?><img src="<?php echo base_url(); ?>img/other/favorite_icon_small.png" alt="" /><?php endif; ?> <a href="<?php echo site_url('view/movie/'. $movie['id']); ?>"> <?php echo $movie['movie_title']; ?> </a> </h4> <p class="meta"><?php echo $movie['categories']; ?> | <?php echo $movie['release_date']; ?> | First watched <?php echo date('F j, Y', $movie['watch_date']); ?></p> <p class="description"><?php echo $movie['description']; ?></p> </div> </li> <?php endforeach; ?> <?php endif; ?> </ul> </div> </div> <!-- list --> </div> <!-- content_segment --> The menu bar search: <menu class="menubar clearfix"> <a class="logo" href="<?php echo site_url(); ?>"></a> <ul class="clearfix"> <li> <a href="<?php echo site_url() ?>"> Home </a> </li> <li> <a href="<?php echo site_url('view/movies'); ?>"> Movies </a> </li> <li class="categories_link"> <a href="<?php echo site_url('view/category') ?>"> Categories </a> <ul> <?php foreach ($categories as $cat) : ?> <li><a href="<?php echo site_url('view/category/' . $cat['id']); ?>"><?php echo $cat['name']; ?></a></li> <?php endforeach; ?> </ul> </li> <li> <a href="<?php echo site_url('admin') ?>"> Admin area </a> </li> </ul> <div class="search"> <form action="<?php echo site_url('search'); ?>" method="GET"> <input type="search" name="search.php" value="" autofocus placeholder="Search" /> </form> </div> </menu> I hope someone finds a solution, I am stuck for 2 days. Cheers.
  18. $create_table = "SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS `" .$date."`; CREATE TABLE `".$date."` ( `transaction_id` varchar(11) NOT NULL, `name` varchar(255) character set latin1 default NULL, `price` varchar(255) character set latin1 default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; $run_query = mysql_query($create_table); Ok so i am some what confused as to why my table is not being created with this. When I insert the query directly into SQL the table is created with no error or issue. So i know the statement is true and syntax is not an issue. When i create the variable in PHP with the same query, then try to run the query, the same table is then not created in the DB. Am i missing a step ? usually this is pretty straight forward when working with DB. I would usually grab the data then fetch the array, then extract the data into a set of variables. Any suggestions ?
  19. I am getting huge errors in error log of my website. Like this [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 58 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_close() expects parameter 1 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 138 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/ticket4t/public_html/management/include/connect.php on line 87 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/ticket4t/public_html/management/include/connect.php on line 34 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 42 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 58 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_close() expects parameter 1 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 138 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/ticket4t/public_html/management/include/connect.php on line 87 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/ticket4t/public_html/management/include/connect.php on line 34 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 42 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 58 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_close() expects parameter 1 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 138 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/ticket4t/public_html/management/include/connect.php on line 87 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/ticket4t/public_html/management/include/connect.php on line 34 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 42 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 58 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_close() expects parameter 1 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 138 [15-Mar-2014 12:34:34 America/New_York] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/ticket4t/public_html/management/include/connect.php on line 87 [15-Mar-2014 12:34:38 America/New_York] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/ticket4t/public_html/management/include/connect.php on line 34 [15-Mar-2014 12:34:38 America/New_York] PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 42 [15-Mar-2014 12:34:38 America/New_York] PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 58 [15-Mar-2014 12:34:38 America/New_York] PHP Warning: mysql_close() expects parameter 1 to be resource, boolean given in /home/ticket4t/public_html/management/include/connect.php on line 138 [15-Mar-2014 12:34:38 America/New_York] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/ticket4t/public_html/management/include/connect.php on line 87 given below is the code of connect.php Please help me to solve this problem. ------------------------------------------------------------------------------------------ <?php class dbcore { var $dblink, $dbhost, $dbuser, $dbpass, $dbname, $link, $Errno, $Error; function dbcore() { global $db_org; $this->getdblinks($db_org); } function getdblinks($pm_dbvars) { $this->dbhost = $pm_dbvars["dbhost"]; $this->dbuser = $pm_dbvars["dbuser"]; $this->dbpass = $pm_dbvars["dbpass"]; $this->dbname = $pm_dbvars["dbname"]; } function setdblinks($pm_dblink, $pm_dbhost, $pm_dbuser, $pm_dbpass, $pm_dbname) { $this->dbhost = $pm_dbhost; $this->dbuser = $pm_dbuser; $this->dbpass = $pm_dbpass; $this->dbname = $pm_dbname; } function siri_open() { global $wwwroot; $t_link = mysql_connect($this->dbhost, $this->dbuser, $this->dbpass); if(!$t_link) { // header("Location: ".$wwwroot."page-error"); $this->Errno = mysql_errno(); //$this->Error = mysql_error(); $this->error("Unable to Connect the Server".$this->dbhost); } $bool = mysql_select_db($this->dbname, $t_link); if(!$bool) { // header("Location: ".$wwwroot."page-error"); $this->Errno = mysql_errno(); //$this->Error = mysqli_error(); $this->error("Database Not Found :".$this->dbname); } return $t_link; break; } function siri_query($my_qry) { $this->link = $this->siri_open(); $qid= mysql_query ($my_qry, $this->link); $this->siri_close($this->link); if(!$qid){ $this->Errno = mysql_error(); $this->Error = mysql_error(); $this->error("Problem In Executing the Query:" . $my_qry); } return $qid; } function siri_count($my_qry) { // returns the count value. $this->link = $this->siri_open(); $qid = mysqli_query ($this->link, $my_qry); $this->siri_close($this->link); if(!$qid){ $this->Errno = mysqli_errno(); $this->Error = mysqli_error(); $this->error("Problem In Executing the Query:" . $my_qry); } $count = $this->siri_fetch_array($qid); return $count[0]; } function siri_fetch_array($qid) { return mysql_fetch_array($qid); } function siri_fetch_accos($qid) { return mysqli_fetch_assoc($qid); } function siri_real_escape_string($qid) { $this->link = $this->siri_open(); return mysqli_real_escape_string($qid); } function siri_fetch_row($qid) { return mysqli_fetch_row($qid); } function siri_fetch_object($qid) { return @mysqli_fetch_object($qid); } function siri_num_rows($qid) { $quy = mysql_num_rows($qid); return $quy; } function siri_affected_rows() { // for insert, update, delete reasons. return mysqli_affected_rows(); } function siri_insert_id() { return mysqli_insert_id($link); } function siri_insert_id1() { return mysqli_insert_id(); } function siri_free_result($qid) { mysqli_free_result($qid); } function siri_num_fields($qid) { return mysqli_num_fields($qid); } function siri_close($link) { mysql_close($link); } function error($msg) { printf("<b>Error : </b> %s<br>\n", $msg); printf("<b>MySQL Error</b>: %s (%s)<br>\n", $this->Errno, $this->Error); } function siri_fquery($qry,$val) { $qid = $this->siri_query($qry); while($re = $this->siri_fetch_array($qid)) { print"<option value=$re[0]"; ?> <?= ($val==$re[0])? "selected": "";?> <? print ">$re[1]</option>\n"; } } function siri_sinvalue($qry) { $qid = $this->siri_query($qry); $rs = $this->siri_fetch_array($qid); return $rs[1]; } function siri_drawNavigation($start,$total,$link) { if(($start%100)==0) { $j=$start/10+1; } else if($start/100>=1){ $j=intval(($start/100))*10+1; } else { $j=1; } if((intval($start/100))>1) { $temp=intval(($start/100-1))*10*10; } print "<div align=center>"; global $len; $check=$total%$len; if($check >=1 ) $lim=intval(($total/$len))+1; else $lim=intval($total/$len); print "<table cellpading=0 cellspacing=0 align=center width=100% nowrap><tr><td width=100%><table width=100% align=center ><tr><td width=100%>"; $en = $start +$len; // if($start==0 && $total>0){$start1=1;} else {$start1 = $start+1;} if($start==0){ if($total>0){ $start1=1; } else { $start1=0; } } else { $start1=$start+1; } if($en>$total) $en = $total; print "<font face=Verdana, Arial, Helvetica, sans-serif size=0 class='links1'>Showing $start1 - $en of $total <a href='$link&start=0'>Go to First Record</a> </font></td><td><!--<img src='../img/prev_button.gif' align=center>--><font face=Verdana, Arial, Helvetica, sans-serif size=1 class='links1'>" ; if($en>$len) { $en1=$start-$len; print "<a href='$link&start=$en1' class='links1'>Previous</a>" ; } else print "Previous"; print "</font>"; $temp1=1; print " <font face=Verdana, Arial, Helvetica, sans-serif size=1 class='links1'>" ; if($en<$total){ $en2=$start+$len; print "<a href='$link&start=$en2' class='links1'>Next</a>" ; } else print "Next"; print "</font></td></tr></table></td></tr></table></div>"; } function shrstr($string, $num="50") { // Check string length if grater then $num if (strlen($string) > $num) { // Shorten the string with ... $string = substr( $string, 0, $num-2); $string .= "..."; return $string; } else { // If $num is less then return $string; } } //////////////////////////////// function siri_insert_query($my_qry) { $this->link = $this->siri_open(); $qid = mysqli_query ($this->link, $my_qry); $lid = mysqli_insert_id($this->link); $this->siri_close($this->link); if(!$qid){ $this->Errno = mysql_errno(); $this->Error = mysql_error(); $this->error("Problem In Executing the Query:" . $my_qry); } return $lid; } }// end of the class ?>
  20. I am building a site where people can order something. then the order will be stored in a mysql db. I would like to track the status of the transaction. ordered or executed ordered would mean that the customer ordered something but the transaction has not been processed yet. executed would mean that the customers transaction has been executed. I wonder what is the best way to do this ? My initial idea was to have a table orders with an order date (the date / time we receive the order), and execution date (date / time we completed the order) and a boolean field to decide if the order has been executed or not. Any better designs for this ?
  21. I have a <a>, on click delete a product from database that is on server, I want to delete the product and the same time delete the image of that product. I using unlink() my code delete the product but don't delete the image and I don't no why someone can tell me what is missing ? if((isset($_GET["remove"])) && ($_GET["remove"] != "")){ $idproduct = $_GET["remove"]; $sql ="DELETE FROM product WHERE idproduct = '".$idproduct."'"; if(mysqli_query($connect, $sql) or die ("Erro")){ //the part that don't work $file = $frontpage_url."/images/".$_FILES["imagem"]["name"]; unlink($file); echo "success"; } }
  22. Hi, I'm new to the forum so please excuse me if I'm doing something wrong..... I only seek help in learning this cool code I recently started some php coding and experimenting with it. I am a fast learner and know some HTML and CSS so have some background. I really want to create a wordpress plugin. Specifically a payment gateway integration plugin that South Africans can use on their wordpress websites. I live in South Africa and have looked far and wide for people to teach me how to do this, the people I eventually found was insanely expensive and it was impossible to get that education from them..... I then started browsing the web learning stuff online youtube,google etc..... this is how I ended up here... Basically I would like to create a payment plugin for my and other peoples wordpress websites and integrate it into any theme....but I do not know how.... I have a sample code for the Payfast payment gateway that they provided and this can be found here: https://www.payfast.co.za/developers/php I basically need someone to teach me how to start and develop this plugin so I can use it in any theme with an admin side control panel and everything... I need to understand the code as well so I actually learn while I do...then test the plugin..... I'll attach the file (Payfast_sample.php) with the php code sample i got from the above URL please help !!! would like to be able to develop my own plugins as I have many ideas.....only lack knowledge to implement Thanks a lot Wollie333 Payfast_sample.php
  23. Hello guys! I need some help here. So this is the situation: I have a page where I teach other students. i want to create a quiz/exam for them. So there is a question and there is a box for answer. And I want that this form correct itself. So he/she click on the submit button and then there will be the results and if an answer is incorrect then there will be an explanation why is that incorrect and why is the good anser is correct. So I hope you guys understand and you can help me. Thank you!
  24. Hi can i find out if it is possible to retrieve rows from my tables in the database but display them as hyperlinks which can lead to a page (can it be just 1 page that allows values to be inserted into?) that allows charts (using highcharts) or so to be created based on the values passed from the database? Sorry if this is a stupid question. I'm new to this and I'm exploring ways to present my data. Thanks!
  25. I want to extract current data from a particular website(http://www.ncdex.com/MarketData/LiveFuturesQuotes.aspx) and then show it on my website. I want to extract only if the Data is "Chana" or else move to next line or stop. Because the website keeps on updating and the field(Chana) always changes its rows. Please help me. <html> <body> <?php $html = file_get_contents('http://www.ncdex.com/MarketData/LiveFuturesQuotes.aspx'); //get the html returned from the following url libxml_use_internal_errors( true); $doc = new DOMDocument; $doc->loadHTML( $html); $xpath = new DOMXpath( $doc); $node4a = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[1]/a')->item( 0); $node4b = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[7]')->item( 0); $node4c = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[8]')->item( 0); $src4 = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[7]/img/@src')->item( 0); $node4d = $xpath->query( '//*[@id="ctl00_ContentPlaceHolder3_dgLiveFuturesQuotes"]/tbody/tr[11]/td[2]')->item( 0); echo $node4a->textContent; // This will print **Chana** echo $node4b->textContent; echo $node4c->textContent; echo $img1; echo $src4->nodeValue; echo $img2; echo "|"; echo $node4d->textContent; echo "<br>"; ?> </html>
×
×
  • 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.