-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
ginerjm is right you need to use ajax in order to call your PHP script when the timer reaches zero. Example using jQuery.ajax method function secondPassed() { ... if (seconds == 0) { clearInterval(countdownTimer); // using jQuery ajax method, send request to uhp.php $.ajax('uhp.php', { success: function(response) { // the response (output) from the script will be added to div#countdown $('#countdown').html(response); } }); } ... }
-
What code have you tried so far? If it is of any help I did help someone here with a their calender.
-
Locked Bump your other thread if no one has replied. Do not post duplicate topics
- 1 reply
-
- grab
- server-data
-
(and 3 more)
Tagged with:
-
You have misunderstood Barand's reply completely. You are storing the data in the database in an inefficient manner. If you set up your tables correctly all you'd need to do is run a simple query like this SELECT name FROM players To get all the names of all the players. But you are storing the data as a spreedsheet. This is not the correct way to store the data in mysql. The Winnners, 2nd place and third place entry details should not be stored in columns. Each player should entered as a separate row in the table. You'd then have a single column which will then denote the players finishing position in the tournament. Then all you'd need to do in order fetch the top 3 players by winning order would be SELECT name FROM tournament ORDER by position DESC LIMIT 3
-
@ravisan you need to use bbcode tags when posting code not <code></code> I have modified you post for you.
-
Program PHP to produce HTML output using tables to render results.
Ch0cu3r replied to Halebutt's topic in PHP Coding Help
What task? If you have issues with your code then post the relevant parts. -
Not sure try changing ' OR ' on this line to ' AND ' if( count($searchwhere)) $query->where('('.implode(' OR ', $searchwhere).')');
-
Windows Server 2012 Question
Ch0cu3r replied to Droffo's topic in PHP Installation and Configuration
I have not posted code. error_reporting is a directive in the php.ini for setting the error reporting level. If you want to modify the error reporting level (temporarily) within your script you can use error_reporting(E_ALL & ~E_DEPRECATED); -
Windows Server 2012 Question
Ch0cu3r replied to Droffo's topic in PHP Installation and Configuration
Yep mysql extension is now enabled! But you will get that Deprecated message because the mysql_* functions are no longer supported, meaning they could be removed in future versions of PHP. It is recommend to convert your code over to PDO or MySQLi. You can lower error_reporting to not report deprecated warnings. By setting it to something like error_reporting = E_ALL & ~E_DEPRECATED But you should take action in resolving the deprecated warnings and not just ignoring them. -
Windows Server 2012 Question
Ch0cu3r replied to Droffo's topic in PHP Installation and Configuration
Make sure you have set the extension_dir directive to C:\php\ext and have restarted Apache too. -
Windows Server 2012 Question
Ch0cu3r replied to Droffo's topic in PHP Installation and Configuration
@Droffo as you have recently install Apache and PHP you need to configure PHP for what extensions to use. The MySQL functions are only available when the you have enabled the mysql extension ( as requinix suggested) above. Before enabling any extensions I recommend that you add your PHP installation folder to the Windows PATH system variable. Then open the php.ini and configure the extension_dir directive to point to your PHP installation extension folder. Only then you can start enabling extensions. -
Inserting array data into multiple rows of database
Ch0cu3r replied to mythri's topic in PHP Coding Help
You need to loop over the values for each of the invE_* fields and get the value. Then build the insert query from the values you have gathered. Example (untested) code $items = array(); // loop over the invE_item field grabbing its value and also the values that correspond to that field foreach($_POST['invE_item'] as $row_key => $value) { $item = $valuel $unit = $_POST['invE_description'][$row_key]; // unit field $price = $_POST['invE_unit_cost'][$row_key]; // price field $qty = $_POST['invE_qty'][$row_key]; // qty field $tax = $_POST['invE_tax'][$row_key]; // tax field $total = $_POST['invE_total'][$row_key]; // total field // formatted SQL string for row values, Example format: (1, 2, 'Item Name', 'each', 1.09, 1, 17.50, 1.28) $items[] = sprintf("(%d, %d, '%s', '%s', %01.2f, %d, %01.2f, %01.2f)", $insert_id, intval($company), mysql_real_escape_string($item), mysql_real_escape_string($unit), floatval($price), intval($qty), floatval($tax), floatval($total)); } // Dynamically build the insert query from the $items array $msql = 'INSERT INTO order_line_items (order_id, company_id, item, unit, unit_cost, quantity, tax, total) VALUES '.implode(', ', $items); -
debug_backtrace in PHP to prevent direct access to page/resource
Ch0cu3r replied to terungwa's topic in PHP Coding Help
What! You do realise what debug_backtrace() does? Its an odd usage case. If you wanting to prevent direct access to config.php (or any other php files) then move it/them outside of your document root. That is simplest approach. Alternatively way could be to define a constant in your main script. Then In config.php you'd kill the script if thast constant does not exist. Example start of coded in main script <?php // define constant define('IN_APP', true); include 'config.php'; ... Then in config.php do <?php // check if constant is not defined if(!defined('IN_APP')) die('Direct access to this resource is forbidden'); When anyone directly access config.php the script will be killed and the forbidden message is displayed. -
Before using msyql_query you need to have opened a connection to mysql. This is most likely why you are getting that error message. See mysql_connect documention for connecting to mysql. NOTE use of mysql_* functions are deprecated meaning they are no longer supported and could be removed from future version of PHP. I strongly recommend you start converting your code over to PDO or MySQLi
-
Using the code suggested by me earlier will not submit any <br />'s only the table name will be submitted.
-
You are not generating the <option>'s correctly. It should be while ($row = mysqli_fetch_array($result)) { echo '<option>'.$row[0].'</option>'; }
-
Yes. Have read of this tutorial on the difference between the different types of joins
-
That is valid SQL syntax. There is nothing wrong with that. MySQL has reported the database and table name like that to prevent obfuscation in the error message. The error message is correct in that the table named head does not exist in the database you have connected mysql to.
-
Where did you download Apache from? The builds provided by httpd.apache.org are incompatible with the windows builds of PHP from windows.php.net. Instead you need to download Apache from apachelounge.com then from windows.php.net you should download a thread safe VC11 build of PHP.
- 2 replies
-
- loadmodules
- apache
-
(and 1 more)
Tagged with:
-
You do understand the different between database and table right? databases contains tables. The error is saying it cannot find the the table named head in the database named Databasename There is nothing wrong with he code. The problem is you have supplied PHP with the wrong database and/or table name(s).
-
You are close. It should be like $result = mysqli_query($con,'SELECT * FROM '.$table); But. You need to be careful how you use $table in the query. You could open yourself upto SQL Injection if you do not santize/validate it correctly. I have to question why is the table name being submitted by a form?
-
Oh, sorry try echo $result[0]['lastname']
-
Change print_r($result) to echo $result['lastname']
-
Is the $username set? echo "Username is: $username";