Adding Result In First Spot
I am trying to match numbers with results ie first
1 result
2 result
3 result
etc
but my do while loop
$counter = "0";
do
{
++$counter;
print ''.$counter.'<a href="?url=singlepic&id='.$myrow[pic_id].'"><img alt="'.$myrow[pic_id].'" src="upload/thumb/th_'.$myrow[pic_id].'.jpg" /></a><br><br>'
}
while ($myrow = mysql_fetch_array($results));
is giving me a blank #1 from the database from some reason, I have the limit set to 10 but it is posting 11, 1 blank and then the 10 I want. Anyone know how to solve this?
View Complete Forum Thread with Replies
Related Forum Messages:
Adding Result Row To Mail Function
I have an email script that will pull the addreses from my club membership database. That part works fine. the problem I am having is being able to include row results inside of the actual email message. My message variable is something like this: Code:
View Replies !
Adding Pagnition To Search Result
I am using a very simple search script. But the script shows all the results in one page... What I want to do is that when there are >10 results then it will divide them into pages. For example search comes up with 50 rsults then it shows 10 in 1st page, 10 in 2nd and so on... At the bottom of page there should be hyperlinked pagnition if result shows more than 1 page > 1,2,3,4,5... Also there should be option for next and previous page... Which would look like this > 1,2,3,4,5 [Next] [Previous] . The page which is current should not be hyperlinks and if there is no previous or next page then it [previous] & [Next] should not be shown. I also want to specify different front size to current page pegnition e.g. 1,2,3,4,5 [Next] [Previous] Code:
View Replies !
Can Someone Spot What I'm Missing Here...
....before I lose what remains of my mind? The problem is that the tetragraph 'PPLL' is apparently not being recognised for some reason I can't begin to see. The test code is: echo 'before the if: ' . $field[10] . '<br>' ; if ( $field[10] == 'PPLL' ) { echo 'IN the if: ' . $field[10] . '<br>' ; } echo ' at the switch: ' . $field[10] . '<br>' ; From which the output is: before the if: PPLL at the switch: PPLL Originally it was not being seen as a case inside a switch (mentioned in the last test code line). So I copied it into an IF in front of the switch as you see in the test code. But it's still not being seen.
View Replies !
Returning To Same Spot On Page?
I have a page that uses PHP_SELF to refresh and add more content. The problem is that the new content appears in the middle of the page, so I would want the user to return to the middle of the page and not the top after the trip to the server. Large sites like www.nytimes.com have this. When you click on a link, read the story and then use the back button to return to the main page, you return to the section of the webpage that has the link you clicked, not the top of the page. Is this created by code? Can I do it with PHP_SELF?
View Replies !
Generate PDF Version Of The Article On The Spot.
here is the scenario, we have over 200K of online documents. we are looking for a script that will be easy to install, gentle on the server CPU and of course cost effective . our goal is to allow our visitors to generate PDF version of the article on the spot. we looked over the web for such applications, and we cant make a smart decision. anyone to offer his/her insight or experience?
View Replies !
Finding A Random Spot That Is Free...
TblSquaresLayout //Contains all squares for the map. -ID -MapID -OwnerID TblMapInfo //Name of the map, its layout size in x * y -ID -Name -SizeX -SizeY -Wrap Now on to the question: How to have mysql return one Random TblSquaresLayout.ID that have a OwnerID=0 and no other squares with OwnerID>0 in a 2 square radius. Lets say MapID = 1 and that MapInfo for #1 is: 1, Test, 50,30,1 -> Map number one is named test and its layout is 50 wide and 30 high and its wraparound, meaning that its... squares are actually positioned upon a sphere surface. Its the Random and the Wraparound part that have made me dump highly structured pop this day.
View Replies !
Save Spot During Meta Refresh
I have a site that refreshes itself every 30 seconds obtaining live data from a file on a remote computer. The last 40 records of that file are parsed and displayed. If someone scrolled down to record 35 and the page refreshes they have to scroll down again. Is there a way for their spot to be saved so they don't have to scroll back down to what may be record 37?
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 !
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 !
How To Go Through Two Result Sets At Once
I've got two queries that are being run: $get_names = mysql_query("SELECT * FROM budget_subcategories WHERE cat_id = Ƈ' AND user_id = Ɔ' OR user_id = '$user_id' ORDER BY name ASC"); $get_income_amounts = mysql_query("SELECT * FROM budget_user_incomes WHERE user_id = '$user_id' AND subcat_id = '$subcat_id'"); Now, here's my problem. I want to grab the 'name' and the 'subcat_id' from the first query. Then, I want the second query to search with the 'subcat_id' from the first query and then grab the 'amount' from the second query's results. I want the basic display code to look like this: Code:
View Replies !
$row = Mysql_fetch_assoc($result);
PHP Code: $result = @mysql_query($get_orderDetails); $row = mysql_fetch_assoc($result); $property_street_type=$row['property_address_street_type'] Say that $property_street_type ==Ɖ' How would one convert that into a name value given the following array. PHP Code: $app_list_strings['orders_property_street_type_dom']= array ( 0 => 'St.', 1 => 'Dr.', 2 => 'Ave.', 3 => 'Cir.', 4 => 'Ln.', 5 => 'Way', 6 => 'Pl.', 7 => 'Blvd.', 8 => 'Ct.', 9 => 'Pkwy.',
View Replies !
Basic $result = (($min == 1)
my code is: if (($hours == 0) && ($minutes == 0) && ($seconds == 0)) { echo 'Error: you cannot have a total time of 0 hours 0 minutes and 0 seconds'; } the problem is, when those 3 values are 0 it doesn't echo an error message. nothing happens. they way i assigned values to time variables were: $minutes = $_POST['minutes']; $seconds = $_POST['seconds']; $rollout = $_POST['rollout']; note i have also tried (($hours == '0') && ($minutes == '0') && ($seconds == '0')) as well.
View Replies !
Parsing CGI Result
I have installed Smart Search Script on my domain. The main file smartsearch.cgi shows result perfectly if I run this CGI directly. I want to show the results of smartsearch.cgi in my PHP page. I have tried different options such as require, include, implode etc. All works sometimes and sometimes not. I mostly tried with include and the code is as follows: Code:
View Replies !
Display The Result
I have a sql statement : mysql_query = "select count(*) from clips where cat = $show[id]"; How do I display the result to this? Normally I put "while($show = mysql_fetch_assoc($result)) { echo $show[id] }" But thats to create a loop of certain results. How do I show the results from a "count" function?
View Replies !
Result From A Sql Query
Is there anyway I can exclude just one result from the database based upon the value of a field, for example i want to exclude the field with an ID of 1 but get all the other fields in the database. is this possible and can anyone tell me how? PS: I had thought about doing something like $query1 = mysql_query("SELECT * FROM table ORDER BY id ASC"); while ($row = mysql_fetch_array($query1,MYSQL_ASSOC)) { $id = $row['id']; if ($id == 1) { //DO NOT DISPLAY ITEM } else { //DISPLAY ALL OTHER ITEMS } }
View Replies !
|