Breaking Rows
I am using a while statement to pull results from my database. Now if I have like 40 results how would I make it break into rows.
So instead of;
result result result result result result result result result result result result result result result result result result
I want;
result result result result result
result result result result result
result result result result result
result result result result result
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Breaking Strings?
I have a string (actually 100's of these, but lets take one): $string ="TI: Some journal title AU: SomeAuthor,-S; Smith,-A; Jones,-B SO: SomeSource. 2002 Jan 9; 287(2): 188; discussion 189-90 JN: Some Journal Title"; This needs to be turned into an array: $entry = array( 'Some Item Title', 'SomeAuthor,-S; Smith,-A; Jones,-B', 'SomeSource. 2002 Jan 9; 287(2): 188; discussion 189-90', 'Some Journal Title'); As you can see, each array item should be defined by what comes after either/all of the following: 'TI:' 'AU:' 'SO:' 'JN:' So, I need to be able to create a pattern that can look through the string and return everything in between TI: and AU:, then AU: and SO, etc. for example: eregi(???, $string, $entry); I'm fairly new to this and can't seem to figure out the regex I need for the pattern. Is this even the way to go about it?
Breaking Out Of An Iframe
I cannot figure this one out. My script is being displayed in an iframe (a wiki page) and I have one option won't give me the correct results unless the page is displayed in either a) new tab in NS browser b) new browser instance. The option in question is used to print forms, and I use the browser Print Preview for the page setup. It's all pretty useless if I have the page and iframe content in my preview. I thought using header() would do the trick.
Breaking A Page Down.
What is the best solution to break down a php page into certain section using MySql, For example i'm looking at designing a page that reffers to a MySQL database that contains the html code for the navigation. So that in future if the navigation changes I'll only need to changed the html code in the database and all the pages will be sorted. I'm also looking at doing the same for the information on the footer of the page, with teh contact details.
Breaking Out Of Quotes
I know I can use stuff like in front of " so that it can't break out of a "" and start doing bad things, but it seems there are other situations where, E.G., if the string is hex for " then it has the same effect, and stuff like that, and it gets tricky escaping it all, so I'm wandering, is there some kind of option I can enable or extension I can install that just simply prevents objects/variables/arrays from breaking out of single/double quotes and also for mysql queries? And also for html so E.G. echo"<img src='$asdf'>"; can't be exploited to do other things? I don't care if it isn't free as long as it works good and isn't to expensive..
Breaking Up Querys
I have a page that updates a table every workday. (these are standard updates, like if someone has moved, or has a different phone number or something.) It is too big of a query to run the entire table all at once, so it is split out. The split is grouped by the first letter of a first name field. Right now it is broken up into 5 parts, and each part has a group of letters (i.e. "a" to "d" is one group, "e" to "k" is the next, and so on. As you can see, these do not have an even number of letters, but that is because some letters have a lot more entries, and need to be in smaller groups.) The reason it is split out into 5 groups is that I can run one group on each workday (Monday through Friday), and I can have the PHP check what day of the week it is. (I use a case statement, the first case is for Monday, the second is for Tuesday, etc.) Code:
Breaking A Loop.
I have one going through rows of a sql database until it matches some data with user input. I need to put a break command in there but can't seem to find out how to achieve this.
XML Parser Breaking Up URLs
I'm having a problem parsing an xml file in which one of an elements character data is a url which contains multiple "&" characters. For some reason the parser breaks up the data into multiple pieces. For instance, when I call this function(abbreviated): function characterDataHandler ($parser, $data) { global $element; global $url; if ($element == "URL") { $url = $data; echo "url=".$url."<br>"; } } I get some output like this: url=http://www.somewebsite.com/index.jsp?s=af url=& url=filter=1 url=& url=show=all Do urls with querystrings have to be handled differently then regular character data?
For Loops Breaking At A Certain Multiple
Can someone help me out with writing a script that will make will loop 500 times, but at every 4th multiple, it will insert a peice of code? I tried all day to get this, and so far, nothing has worked.
Characters Breaking My Query
Im using encrypted data to store cc info. The PHP code encrypts and sends the result to the database. the problem is that the encrypted string contains lots of characters that will break my sql query. I can do a replace but there are lots of characters. for example, a character will look like this: g%$^'GDF$%^//"@#$%/||''$#"/|#dfsa. how can I put this information in a different format... and then retrieve the data to decrypt the string?
Not Breaking Loop In Function
I get this error: <b>Fatal error</b>: Cannot break/continue 1 levels in <b>file.php</b> on line <b>128</b><br> This happens when I call a function. In the function there is a break; This is cause the break is in a function and not in the loop. But it gets called inside the loop. Is there a fix for this?
E-Mail Not Breaking Lines
I'm sending an e-mail via a contact form, but somehow the lines aren't breaking in the text, it always looks like this: lorem ipsum dolor sit amet lorem Which is of course not readable at all. What am I doing wrong here? I'm using a few security checks and such for cleaning the field up; $text = trim($text); ... $text = stripslashes(strip_tags($text)); ... $text = mysql_real_escape_string($text); ..... #and then the part where it's included in the message: $message .= "Nachricht: {$text} "; Can any of those be causing the display problem?
Script Breaking On Mysql_result
I was trying to figure out why one of my scripts was failing and by using an "or die" statement for the SQL narrowed it down to this bit of code: $md5 = md5_file("swf/" . basename($jpg_link)); $dupe = mysql_result(mysql_query("select count(gId) from games where gSwfFile='$md5.swf"), 0); if(!empty($dupe)) { continue; } This is giving the following error - "Warning: mysql_result(): supplied argument is not a valid MySQL result resource" The thing is, I've checked that SQL query by running other values in place of $md5 through it and it appears to be fine. select count(gId) from games where gSwfFile='Flat War july 30th 2007.swf'; Any ideas?
Breaking Backwards Compatibility - Good Or Bad?
If you have any PHP scripts which will not work in the current releases due to breaks in backwards compatibility then take a look at http://www.tonymarston.net/php-mysq...everything.html and see if you agree with my opinion or not.
Breaking Survey Into Seperate Parts?
I have a very long survey form with 4 different sections. Is there anyway with php to split this form into 4 popup windows so the person can click on the section they wish to fill out and when they are done, go back to the host survey form and continue on? I know there must be a way to do it, i'm just at a loss as to how i would pass the variables off? Cookies perhaps?
Breaking Up A Comma Seperated List
i have a list seperated by commas: 1. 3. 5. 7. 9 actually is a varible $members ="1, 3, 5, 7, 9"; what would be the best way to break that up to insert the values into a table in a loop.
Breaking Up Text For Multiple Pages
I was recently put in charge of heading up my company's website, and while I have a lot of experience on the design side of things, I'm still very new to the programming side. When I started, the website had just gotten a revision, but the site was an utter mess, so I've been trying to fix it up. As I've gone along, I've learned some aspects of PHP, but my knowledge is still very limited. Here is the problem I'm trying to fix. A backend is used to enter information into our MySQL database, and then a page template pulls it out to make the page. For our reviews, the PHP coding currently breaks up the review's text so that it can be places across multiple pages. The problem is, the way the text breaking was set up, the end of one page and the beginning of the next are totally chaotic, with breaks often coming mid-sentence. Here is what I'd love: other coding automatically puts an HTML break at the end of paragraphs, and then another in the space between one paragraph and the next. I'd love to have the code search for when those double breaks come up, and then break up the text after, say, every sixth pair of HTML breaks. I'd also like the option to break the text myself by putting in some sort of text code in the original text. At this point, though, anything that can make the breaks more elegant would be a huge improvement. I really appreciate any help anybody can give me in this one. Please remember that I know very little of PHP, and I'm not much of a programmer anyhow, so things that you may take for granted that people would understand about PHP, I might not know. I tried to pull out what I thought was the current coding for the text break. Here it is. I'd also like to get rid of the part1/part2 factor. Before, they had the text breaking to help in fitting into the layout around an image, but I've fixed that so I no longer need the break. So, that portion no longer needs to be a factor. if ($page == ""){ $page = 1; } $no_letters = strlen($Game_Full_Story); $times = ($no_letters / 3800) +1; $Game_Full_Story = wordwrap($Game_Full_Story,3800,"*#^"); $Game_Full_Story = explode ("*#^", $Game_Full_Story); $pages = array(); for ($i=0; $i<$times ; $i++){ $part[$i] = $Game_Full_Story[$i]; if ($i != 0){ array_push($pages, $i); } } $page = $page-1; $story = $part[$page]; if (strlen($story) < 460){ $parts1 = $story; }else{ $story = wordwrap($story,460,"*#^"); $story = explode ("*#^", $story); $parts1 = $story[0]; $count = count($story); $parts2=""; for ($i=1; $i<$count; $i++){ $parts2 .=$story[$i]; $parts2 .=" "; } }
Breaking Up A String Into Individual Words
I have a text box that I will use to search a database. I would like to use it so that it will not use a whole string (ie. 'red striped top') but instead break it up into individual words (ie. 'red', 'striped', 'top') and maybe put it into and array. I will then use the words in the array to search the database. How do I break a string up this way? Also, is this the most common way of creating a means of searching a database?
Breaking Up The Query String Dynamicly?
using $Get_string = $_SERVER['QUERY_STRING']; to receive a query string such as month=may&$day=15&year=2006 so that $Get_string = "month=may&$day=15&year=2006" can I separate the values and turn them into variables? (like a normally would with a url get) $month = "may" $day= "15" etc it would be great to just do $_GET on the url but I'm sending the string as a variable to another script... so i can't just go the easy route.
Breaking The BACK Button (Refresh Problem)
I have a php page which serves up multiple pages based on how the user interacts with it - there are links on the first page that will reload (from the same php file) a new page with form fields and submit buttons, and when a user posts from that new page (or cancels), then the same php file is again loaded, detecting how the user responded and generating the appropriate html for whatever should be none next. All very typical. What I want to know is, is there a way so that once a user has posted from some submit button from one page (we'll say he Cancel's from a page that had a form Cancel button so he returns to the original non-form default page generated from the php file), can it be made so if the user then "refreshes" the new page (hits the Refresh or Reload browser button) he does NOT get the browser's "The page cannot be refreshed without resending the information. Click Retry to send the information again, or click Cancel to return to the page that you were trying to view." dialog? In other words, what I'd like is a way to have the browser think that there was no posting done (even though there was) once I've generated this certain 'home' page with my php code, so that user ReLoad's of the page won't get this warning. This is probably related also to problems I've had with "breaking the BACK button" on sequences of php pages: if the user BACK's up to a page that was generated by a post, it may not even be possible to regenerate the original page.
Return Data Breaking Input Field
My return data is: (I have nothing to do with how the og person choose to input this) <font color="#800080">CASE</font> and I am setting the value of a input text form field equal to that return $input = "<input type="text" name="queOpt". $i ."" value="". $this->_queArr[$i] ."" />"; im lost on how to fix this. addslashes doesnt make sense - maybe it is the double quote thing
Counting Rows
I need to get the number of rows in a table. This is the query I'm using at the moment: $query = "SELECT COUNT(*) from mytable"; $result = mysql_query($query) or die ...; What php function may I use to get the number and in which way? I tried with $num = mysql_num_rows($result); but nothing.
Grouping Rows
I've gotten a few rows, that I want to sort based on the date that it's scheduled. This means that I've gotten different rows, and I want to create something like this: Monday 99 Januari: Row1 Row3 Tuesday 99 Februari: Row2 Row4 This way the system sorts the rows by date and groups them. Only I still haven't found any way how to do this. Any ideas?
How Many Rows In A Table
I am sure there must be an easy way to determine the number of rows in a table, but I can't find it.
Get Number Of Rows?
Is there a way to get the number of rows returned from a query? (database used: MySQL)
Missing Rows
I've been trying to retrive a limited numbers of rows ordered by a date and it keeps on returning 1 row less than I've wanted. code:
Counting Rows
I have an admin system (Add/Modify/Delete) for two types of records in the database. They have a Parent - Child relationship My problem is that I want to display on the "parent" record whether the child exists or not . The records are found in two different tables, but have the same Primary Key.
Say I Have 48 Rows, How Would I Seperate Every 12?
I have to create an html page that will be printed and it has to be THE SAME as the old page made in Excel. I'm right now because for each query (could have 1 to 65 or any number of rows) I have to seperate the results into groups of 12. PHP Code:
New Table Rows
I retrieve 20 items from a MySQL database. I want to display the output in a table. How can I display 5 items on a table row and then begin an new row?
Getting SQL Rows For A Week
I have a database that uses two date fields for tracking information. The first field is for the addition of the record and the second is for the expiration. I have a small section that I want to list records that will expire in the current week (or for that matter in the next 7 or 14 days). What is the syntax that I would use to call mySQL with to get that info.
How Do You Add Values In Rows Together
I am using the following code to take records out of a Mysql database and display them on an HTML form. $myrow[8] is a number. At the bottom of the table, I want to display the sum of all the $myrow[8] values added together. Code:
Autentication Rows
when i try and log in, the script bellow keep throwing an error back on the last 2 lines i have commented over $numrows and $rows. can anyone point me in the right direction. I am not looking for someone to fix the code, but I need guidence. Code:
Returning All Rows Instead Of Row By ID
When I try to call data for only one person using the below code, it displays everyone in the database. What am I forgeting to do? Im refering them to this from options.php?id=<? echo $row->id; ?> PHP Code:
Rows Affected?
I am executing an update-query. Is there a way I would get a result if there is a row affected, because if the row isn't affected (product may not exist) I have to execute a insert-query. This way I could use 1 query (in the update-case). Else I would always have to execute 2 query's (1 count-query and 1 insert or update query).
Trying To Delete Rows.
I am trying to use php to delete rows for a mysql database table, i am using the following code with $journeyIDToUse being a number that represents a automaticly incrementing primary key. $toDelete = "DELETE FROM journeyData WHERE journeyID='$journeyIDToUse'"; mysql_query($toDelete); This fails to delete the row. I have tried changing $journeyIDToUse to a number and that worked so i thought that the variable might be at fault but the following query works so that rules that out $searchString = "SELECT * FROM journeyData WHERE journeyID='$journeyIDToUse'"; $result = mysql_query($searchString); $row = mysql_fetch_array($result);
Ordering Rows By Value
Is it possible to display rows in order of a value within the rows? I need to do this without saying 'order by' in the 'select from' statement. The reason is because i'm using values from my select from statement to work out totals. Once i've worked out the totals i'm displaying the rows as per the code below. This works fine but I want to display the row containing the smallest $TOTAL_REDUCED value first, with the next highest next, and so on. Code:
Need Rows With Certain Dates
I have rows in a db stored with dates in the form of: 2007-07-07 00:00:00 (type is text). I need to get all dates between now and 14 days from now. Can I get some help on how I should do this? Since the type is text, do I have to use strlen? Or can I do this all in the query somehow?
Max Rows Cannot Add More To My Database
I need to add more rows to this table, and I cannot.....? I'm not sure if this is a SQL problem, though when I look at the setup of the table all TYPES are set to (int)11. I'm a newby so i'm not sure if the PHP is scripted to limit database input. I am at 2249 on my attribute rows. Code:
Selecting 10 Rows Together
I have this script that displays verses out of the bible. The problem is that it is only displaying one verse. I would like for it to display about 10 verses in a row. Random selections though. $result = mysql_query("SELECT * FROM bible ORDER BY RAND() LIMIT 1 "); // WHERE catid <> 'TBP' while($myrow = mysql_fetch_array($result)) { $title = $myrow['book'].' '.$myrow['chapter'].' : '.$myrow['verse'].'<br /> '.$myrow['text']; echo $title; echo "<br />"; echo "<br />"; }
Displaying 10 Rows (Newbie)
I need help....I want to display 10 hits from my sql database..... A function that wil select the first 10 rows of my database and then also provides me with a link to the script itself to diplay the next 10 hits (Or less, if there is no more).
Inserting Multiple Rows Via The Web
I would like to have a form that can have multiple rows inserted on the same page and then submitted to the database in one click. How would I go about doing this with, say, three text fields that are named "name", "email", and "URL"?
PHP/mySQL Counting Rows In My Db
I'm building a little news board and I need to count the total number of rows in my db ... simple, I know... but I can't get a result. here is the code...
Updating Multiple Rows
I am trying to create a form to update multiple entries in a mysql databse. This code below is rough, but it is working to the point wher it pulls the data, displays it in the text areas (but it does not go past the first white space in displaying, that needs to be fixed), and then I can alter the text fields, check a box, and hit submit, and it will update the fields, but the new value is size=20. I also can't update more than one record at a time, which defeats the purpose. Any ideas?
Deleting Rows In Mysql
Is there a way in php that I can mark a row in my mysql database and then later so delete these rows that have been marked?
Displaying Entries In Rows Instead Of On Top Of Each Other
I'm altering a voting script for our dog rescue so that we can hold an online photo contest. I'm very new to php & mysql..kinda just muddling my way about with this. I want to display the entries in a row across about 4 or 5 photos and then keep it going that way, but I haven't a clue as to how to do this....
Warning: Mysql Num Rows():
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/domain/public_html/signup.php on line 159 source code:
Updating Multiple Rows
I have a databse with a list of employees, I also have in that database a field that shows their status 1- Out, 0 - In. What I would like to do is make a page that will list all of the employees with their current status in radio buttons that I could then make changes and submit that will then update the database with the changes for all of the employees. Here is the code I have for the first page: PHP Code:
|