Format The Result Like This, 16:13:22 ?
Im pulling information from an xml file tha returns the time formatted like this 161322, how would i format the result like this, 16:13:22 ? Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Format Table With PHP Result
I have to create some kind of dynamic page, logic is next: i have integer in variable and i need to create certain number of fields based on that int. example $variable = 6 and I need to have table with 6 fields, 4 in one row and 2 in second....my problem is how to do that, how to get new <tr> when number in bigger than 4.
View Replies !
Format Result Text Using Passthru Of System
I tried to use the Passthru and System function to resolve some whois information. echo passthru('whois 62.69.168.12') .'<br>' -or- $whois = system('whois 62.69.168.12', $retval); It works fine, but all the result text is at one line. How can i format this output correctly ?
View Replies !
Changing Array Format From Result Of MySQL
here is what MySQL returns in a visual way.. game_id | team_id | stat_id 1 | 1 | 1 1 | 2 | 3 1 | 3 | 7 1 | 3 | 6 2 | 1 | 1 2 | 4 | 3 in records with the same game_id, there will be no repeating team_id in records with the same team_id, there will be no repeating stat_id so, after I got the query, I made them into this format PHP Code:
View Replies !
Convert UNIX Format Into An Hours:Minutes:Seconds Format
I have a a UNIX format number that I want to convert into an Hours:Minutes:Seconds format for a stopwatch/countdown timer script I'm writing. I used date("H:i:s", ($time)), but the problem is, if the period I'm counting is above 24 hours, the Hours reset to 0. So If I was counting down 49 Hours, It's be displayed as 01:00:00 instead of 49:00:00.
View Replies !
Date/time Format To Be A Normal Format
i want my date/time format to be a normal format... ex. 1-11-2006 9:20pm.. it comes out for me like 2006-1-11 21:00:30 code i have is... how could i have it so it displays it normally... <?php echo $filelist_array["date"]; ?>
View Replies !
Format Currency - Dollar Format
I want to take a variable and make sure that I output to the browser in dollar format ie if I set $price=100. I want to make sure that $price appears as 100.00. in turn make sure that when $price=100.97 is outputted as 100.97
View Replies !
Displaying Result 1-8, Then Result 9-17 Etc.
I dispaly the results from the database like this. <? while ($row = mysql_fetch_array($prod_result)) { $small = $row[0]; echo"<td align=center><img src="produkter/hardware/decks/$small"></strong></td>";}?> But if there are more than 8 results, I wnat to dispaly the first 8 on one page, then the next 8 on the next page...How can this be done?
View Replies !
Nesting Result Loops Within Result Loops Possible?
I'm looping through a query, and inside the while result output, I am trying to loop through a second query (created from the 1st query's row results). I have checked that both queries return info. I can see that the 1st while result output works fine, but when I get to the inner while result output, it never returns any rows (nothing in the while loop evaluates). So, IS it possible to nest one query's output loop within another, or am I doing something wrong?
View Replies !
Creating A Result Page From A Result Page...
I have a contact management database (4500 records) where each record contains many columns = a lot of data to look at in one go. So... I have created a search page to look for "Company" or "Name" which then returns a recordset with a primary ID number and a summary of 5 other fields. This recordset is then displayed on a results page in a dynamic repeating table which just shows simple record lines. My aim is to then be able to go from the results page to another detailed result page based on the ID of a specific selected record. I understand how to generate the recordset from a text box but cannot find out how to create a recordset from a dynamic repeating table.
View Replies !
SQL Last Result
When querying and doing a loop I want to specify that the last result of the loop does not include a horizontal line. How would I do this?
View Replies !
Get More Than 1 Result
I have wrote a PHP script, with MYSQL, that reads a database based on users input. When the criteria only matches one result in the database, everythings fine. But when the data has two results I need to display, I only show one. Do I need to write some kind of loop?
View Replies !
Zero Row Result Set
When I am doing a search, if there are no results, PHP Code: $num=mysql_num_rows($result); gives me an error. I want it to say something like "There are not matching records." Instead, it returns a message that says: PHP Code: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:WAMPxampphtdocsregsearch.php on line 30 How do I avoid returning this error message?
View Replies !
GIF Format
Is it safe to write scripts that support the GIF format because ive been reading some stuff about this and it's got me thinking Can anyone tell us what's the standpoint regarding PHP developers and writing scripts that support the GIF format.
View Replies !
DB Format?
iv been practiceing a few bits an bobs on a website and the base of what iv been doing it for it show certain databases. I'v still not a clue how it works but the database format is Borland paradox format. I want to transfer this database to excel is some way without having to retype it up. Any clue on how to do this? The only program i can get it to open up in is DB commander.
View Replies !
New To Xml Format
need to start using xml data eventually so thought i'd learn some basics! i normally export my data using variable for flash but want to use xml for the one below. Code:
View Replies !
Outputing Result Once Only
Hi, I have a php script that looks up mysql records, on the basis of keywords entered by the user. The records are in tables making up a message board system, and the search works both for 'top-level' messages, and for replies. The results lists the 'top-level' message (ie the entire thread), even if the search matched text in a reply. However, I am having a problem making sure the thread is not listed more than once if the search matches several replies in the same thread. At the moment, the search looks up all the rows containing the search text, then the message starting the thread if the search has matched a reply, and the results are output in a while loop. I have tried making a long string containing all the id's of the displayed rows, usingsomething like $displayed .= _$row[id]_ in the loop, and then ereg("_$row[id]_", "$displayed", $array) earlier in the loop to see if this message's thread id is already listed, and skipping it if it is. However, I can't seem to get this to work. Also, this seems like a really inefficient workaround. Is there a better way to do this?
View Replies !
Result Using Two Variables
Probably a real simple solution but I can't for the life of me work it out. I have: $pollitem_1 $pollitem_2 $pollitem_3 $pollitem_4 if I do a for loop for the amount of items, is it posiible to have a variable for the number after the _ ? e.g....
View Replies !
Weird Result? Php 4.4.0
I have a variable v with the value -1. After v++ it has the value "" not 0. Since I am using it for a subscript, the "" value is not overwriting the 0 element of the array as desired. Should v++ ever give a non-numeric value?
View Replies !
Result Set Problem
I am new to programming in PHP however, this should be a pretty straight forward answer. I have three queries that I am pulling for a content form page. 1) The Author List 2) The Content Page (pulls the PK, Title and the Description of the content. 3) The Category List When I attempt to pull the data the only result set I get back is from the Item #1 query above. Now, I made sure that there is data in the tables, but I still get no data back for the other two queries(????) Is there something that I missing when connecting to PHP/MYSQL? Do I need to take some additional steps?? Any help would be greatly appreciated. I've been struggling with this problem for several hours now scratching my head why this is. :-) // here is the PHP Code I am using <?php $db = mysql_connect("$DB_SERVER", "$DB_SERVER_USERNAME", "$DB_SERVER_PASSWORD"); mysql_select_db("$DB_DATABASE",$db); //result set 1 - get members $result_M=mysql_query("SELECT * FROM tblMembers",$db); $myrow_M=mysql_fetch_assoc($result_M); //result set 2 - get content ID $result_C=mysql_query("SELECT * FROM tblContent WHERE contentID=1",$db); $myrow_C=mysql_query($result_C); //result set 3 - get categories $result_Cat=mysql_query("SELECT * FROM tblCat",$db); $myrow_Cat=mysql_query($result_Cat);.....
View Replies !
Oracle->not Same Result From Php And From Sql*plus
Here is my query, ran from oracle sql*plus: SELECT mrbs_room.id, start_time, end_time, name, mrbs_entry.id, type FROM mrbs_entry, mrbs_room WHERE mrbs_entry.room_id = mrbs_room.id AND area_id = 101 AND start_time <= 1076068800 AND end_time > 1076065200 Here is the correct result : SQL> Connected. ID START_TIME END_TIME NAME ID T ---------- ---------- ---------- ---- -- - 82 1076065200 1076068800 test 41 I Ran from php, I got this : ID START_TIME END_TIME NAME T ---------- ---------- ---------- ---- -- - 41 1076065200 1076068800 test I the two ID fields are named with their table name, but php keep the second value and display it as the first one.
View Replies !
Paging Through Result Set
Using PHP to query a MYSQL db, I am attempting to portion the result set on multiple pages. I see this technique used on this site. example: If a user query yields 30 results I want to display 5 results at a time allowing the user to page forward or back through the results.
View Replies !
Result Handler Set?
I'm getting an error which get's reported something like "can't save result handler blabla".. .. i didn't note the exact error at the time and i can't bring it back cuz i deleted my whole database and started from scratch.. anybody know what this is about?? i'm pretty sure it's something to do with mysql.. it shows with mysql_error().
View Replies !
Search Result Help
I am trying to do the following with my search script that looks for records in a mysql table. The following is an example of what I am trying to do. Text being searched: -- The brown fox jumped over the green fence then jumped into the web monitor. It was hurt so it jumped backwards and fell on its! -- The word we're searching for "web". The results should look like -- ...then jumped into the *web* monitor. It was... -- Are there any functions out there that will do this? Or what would it take to make one?
View Replies !
How Could I Paginate The Result Set?
I would like to do something like this: select * from myTable where ... pagesize 10 page 1 How could I do it elegantly in: 1. PHP+MySQL before MySQL 5 (without stored procedures) 2. MySQL alone (with stored procedures)
View Replies !
Mysql_query Result
I have a small problem with PHP and MySQL. I want to know how to check if a value is existing in a MySQL database using PHP. The code is below: PHP Code:
View Replies !
Result Sets
I am having alot of trouble trying to append a result set using a loop. I am taking a number from options from a select option list in a form and for each of these i want to execute the statement. for($y=0; $y<$totaltown; $y++) { $result=select statement} and then out put the info using a while loop. My problem is the result set keeps overwriting itself until it produces 0 results. I have tried using $result+=$result but it is then no longer a ersult set. The code i have works fine when i only want to produce all hte results on one page but i am paging the results which is where my problem lies ie LIMIT.
View Replies !
Incorrect Result
i try to insert a text in a database (mysql) in this text, there are php code i want to display... i use <code>...</code> to do this job str = $_POST['texttutoriel']; $str = preg_replace_callback('`<(code|url|img)>(.+?)</1>`si', 'bbcode', htmlentities($str)); $str = mysql_real_escape_string($str) my bbcode function: function bbcode($m) { switch($m[1]) { case 'code' : return '<div class="code"><pre>'.$m[2].'</pre></div>' break; //... } }
View Replies !
Looping A Result
Im new to PHP and MySql, Im trying to setup a really basic news script for me to use for my site 2design4.com. PHP Code:
View Replies !
Add Sql Result To An Array
I am trying to add the results of a query (specifically a particular field's value) to a new array. The result is either an empty array or the last row in the query result instead of all the rows. Code:
View Replies !
Maths Result...
I have a mathematical calculation, and for some reason if i put "1" into the input this is the result i get : Quote1 Muscle Building sessions giving you a strength gain of 4.99999999999E-5. I have put a script in to cut the decimals so that it'll only go as far as 5 decimals but it still keeps coming up... $DecimalRemovalStrengthresult = number_format($GainTotalStrength,5); $DecimalRemovalStrength = number_format($NewStrength,5); That is what im using to strip the number down so it should only show "4.99999" If i don't put "1" and I put say anything above 1 it'll work fine and only show a figure of 5 decimal places such as 4.99000. So what is actually happening to the number to come up with 4.99999999999E-5 ? Does the value mean infinite number or something else?
View Replies !
Array Result
PHP Code: function match_username()         {             $connection = new db_connect;             $connection->connect();             $this->table  = "bs_user_member";             $this->query  = mysql_query("SELECT username FROM $this->table");                 while ($this->result = mysql_fetch_object($this->query))                 {                     global $uname;                                         $uname = array($this->result -> username);                 }                            } Should show all right?
View Replies !
Displaying Result
I have a page with a for-loop that takes a long time to execute. In this loop, a line of data is printed using printf (or echo). I currently see the printed data only after completion of the for-loop. What I'd like to have is that each bit of data that is printed in the loop, displays at once, so that I can see the progress of the loop. Is there a way to achieve this?
View Replies !
Return Result Set In SPs
how can we have a select satement in an SP?(i want to return a result set from the SP). i want to migrate from SQL Server to MySQL and i don't know what to do with these SPs. it can be done in MySQL client, but it gives the error:"procedure foo can't return a result set in the given context MySQL" in the application. can i set a cursor out put parameter and return it?(just like Oracle) or it has another solution? and another question: is MyODBC 3.51 tested with MySQL 5.x? can we call an SP from Delphi via MyODBC? (i tried to do so (using ADO an a data provider for OLEDB) but i think somewhere in passing the call statement it had put {} around "call sp()" statement so that mysql returned an error about the syntax.) .
View Replies !
Getting First Result From Array?
Trying to get the top 10 male authors from my database that works fine .. but id also like to just get the top male author too So since ive fecthed the top 10 , shouldnt i be able to get the top 1 from that? Code:
View Replies !
Echo A Result From A SUM()
I am using the SUM() function to add an entire field together. For example $sql = "SELECT SUM(user_count) FROM locations WHERE 1"; I'm a little confused on how to get the result to echo to the HTML.
View Replies !
OBJECT, Instead Of Result
i am running this query $vendorid= $db_object->query("SELECT id FROM users WHERE username = '".$_SESSION['username']."'"); When I echo the result I just get OBJECT. The session variable is displaying Ok and the SQL is correct. Am i missing something?
View Replies !
Result Location
If I select a single row from a table and order results by the primary key (auto incrementing #), how would I know the position my selected result is in? So "Result 5 of 58" works without running loops.
View Replies !
Can I Save A Result And Use It Later?
I have a php page that displays a list of results obtained from running a query using variables passed from a Search Form using Post. I'd like to save the result set to a Session variable so I can later display the same result set and page after a user has added an item to their cart. However, when I tried this, I get the following error: Notice: Undefined variable: arr in C:PHPpearDB.php on line 756 Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition <b>db_mssql</b> of the object you are trying to operate on was loaded _before_ the session was started in C:PHPpearDB.php on line 756 The code I used is: $conn = db_ifw_connect(); $result = $_SESSION['search_result']; // the debugger tells me that the session variable is a db Object while ($row = $result->fetchRow(DB_FETCHMODE_ORDERED)) Evidently there are some other things that I need to do besides just setting $result = session variable. Any idea what I am missing?
View Replies !
Echo Result
this is prolly gonna be the simplest answer but im stumped. I ve written an email form with validation in php and i want to return a value from a list menu that was selected before the form was processed to reveal some errors, just so the user doesnt have to put it back in. I can do it with input fields easy enuf but im stumped with this. Thas my echo code i have been using: <?php echo $_POST['name']?> this is my list/menu <select name="select"> <option value="" >Please Select</option> <option value="Normal" >Goodbye Neighbours (Normal)</option> <option value="Advanced">Goodbye Neighbours (Super Advanced)</option> </select> Can someone help me out?
View Replies !
Suppress Result
Is it possible to have mysql_query NOT return a result? Or,is it possible to suppress the result and therefore just have the query executed without generating anything in return? My problem is caused by the fact that I'm trying to track when a particular user is logged into my website. THe problem is that when the user navigates to another webpage, the php script returns a result and prevents their intended page from loading. I'd like to find a simple php script that can _just_ UPDATE the db and not return a result, allowing my user to go merrily on their way to another site.
View Replies !
Reducing The Result
I have a text field for a news story. What I would like to do is call two versions of the field $story. One is the complete $story field, the other is the $story field, but limited to the first 15 words in the $story field. How can I do this?
View Replies !
|