Displaying Single Row For Same Column No
I have a table as follows:
----------------------------
Auth Name | Paper No
-----------------------------
Gupta 7
Daiya 7
Daiya 8
I want the above table to look like if two rows have the same paper no
-----------------------------------------
Auth Name | Paper No | Paper No
-------------------------------------------
Gupta 7
Daiya 7 8
Can you please modify the below code:
if ($result){
echo "<table border=1>";
echo "<tr><td><b>Author Name</b></td><td> <b>Paper No</b></td></tr>";
$numOfRows = mysql_num_rows ($result);
for ($i = 0; $i < $numOfRows; $i++){
$name = mysql_result ($result, $i, "aname");
$email = mysql_result ($result, $i, "apno");
echo "<tr><td>$name</td><td><a href="abstract/$name.pdf">$email</a></td></tr>";}
echo "</table>";}
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Select Single Column From Mysql Into Array
Is there a way to select a single column from a mysql database and directly put the results into an arrray? Here is the workaround below, but I would like to elimniate the array_push step: $uids=array(); $res = mysql_db_query("db", 'select uid from tbl;', $link); while ($row = mysql_fetch_row($res)) { array_push ($uids, $row[0]); }
Displaying A Single Entry In Two Separate Places
I have a database entry that's super long (an entire first chapter of a book) and I want to display it on the top left side of a div until it reaches the bottom and then, after it reaches the bottom of the div, have it automatically flow into another separate div. This would occur on paginated pages so I'd need it to continue flowing to the next page then do the same auto flow thing again. Picture a book that reads from left to right and that's basically what I'm trying to do. Is this possible with php? Is this possible period?
Displaying MySQL Column Names Using PHP
I'd like to be able to display the column names of a table on a page. Is there a way to read that information in using SHOW? And then to display that information again? Or would I have to store these names in a seperate table and display these values? I tried this, but it sure didn't work: $result = mysql_query ("show columns from industries"); print ("<table>"); if ($row = mysql_fetch_array($result)) { do { print ("<tr><td bgcolor=#cccccc>"); print $row["field"]; print ("</td><td bgcolor=#cccc00>"); print $row["type"]; print ("</td><td bgcolor=#cccc00>"); print $row["null"]; print ("</tr>"); } while($row = mysql_fetch_array($result)); } else {print "Sorry, no records were found!";} print ("</table>");
Displaying Information In A 1 Row/2 Column Table
I'm very new to php scripting and haven't quite figured out what I need to do here. I need to display information in a 1 row/2 column table. I have the MySQL query working fine, but the scripting part in php is killing me! In the first column a graphic about 70x70 will be shown (plus some additional padding). In the second column will be the description information. The second column will be around 400 pixels wide. How do I set this up in php? It's easy enough in HTML, but I've about killed myself trying to figure out how to properly lay this out in php!
Problem Displaying One Column Of One Row From A Database With PHP.
I have a small script with PHP that queries a MySQL database to pull out one row, where I want to be able to access each of the columns separately. I have tried several different variations and am able to get the entire row to print, but when I attempt to access the individual columns I get an error. Here is what I have so far: if (isset($_POST['memberNo'])): $link = mysql_connect('...','...','...'); mysql_select_db("..."); //Perform a test query $query = "SELECT * FROM users WHERE 'id' = " . $_POST['memberNo']; $result = mysql_query($query) or die(mysql_error()); $line = mysql_fetch_assoc($result); print $line; //Close connection mysql_close($link); The point of this code is to retrieve the user information to validate the login information sent in the previous form. I do not get an error with this code, but it also does not print anything. I know there is an entry in the database that matches data sent in the $_POST['memberNo'] variable, it is the only entry in the database. Changing the 'print $line;' to 'print $line["id"];' does not display anyting either.
Displaying SQL Query Results In 3 Column Table
I would like to be able to display the results of an sql query in an html table, but the results need to be displayed in three columns, for example: Column 1 Column 2 Column 3 Result 1 Result 2 Result 3 Result 4 Result 5 Result 6 Result 7 Result 8 Result 9 I've tried to find the answers on the internet but i can't find anything that suits my needs!
How To Query From One Column Then Sort Using Another Column
I am trying to get the last 100 albums I entered into my database using the album_id (Highest being the latest entry) then sort them alphabetically using the album_title column. I can get the latest 100 easily but cannot figure out how to also sort the results by the album_title before I display them. This is what I have so far which gets what I want but not in alphabetical order. <?php $sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100", $db); while ($result = mysql_fetch_row($sqlquery)) { echo "<a href='music_info.php?album_id=$result[0]'><span style='text-decoration: none'>$result[1]</span><br></a>"; } ?> I have been trying to add a second ORDER BY to the query like so. $sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100 ORDER BY album_title", $db); but this obviously isn't the way I should be doing it.
Single Quotes
I'm having trouble with single quotes in a string being inserted int o a textbox like this:- <? echo "<INPUT TYPE='TEXT' NAME='vsign' VALUE='$vsign'>";?> Now If $vsign="text with sing'le quote"; this displays :- text with sing in the text area. PHP appears to read the quote as the end of $vsign. I've tried escapes but they dont seem to work.
Single Sign On
I have added an additional service for my clients that is on a third party web application. The application is password protected and currently they are required to login to its service using the developers sign in page (there logos not mine). Once in the application it is all my branding (just not the login page). Is it possible to add a login section on a page on my website that once submitted runs a script that will autofill the applications login page bypassing its view?
Single Sign On
I want to make a single sign on login.I'm try using javascript but this is not function, if i use different server.Then i try using curl library. but it doesn't solve my problem.i don't have idea to solve this problem. So, anybody can give me idea?
Single Click Downloads
How do I ptogram with PHP a link that when clicked starts downloading the file? Basically I dont want to link directly as I want to take note of the number of times a file is downloaded so I need some way of sending the file back to the browser after I have done some housekeeping.
Getting Single Words Into A Database
I have something where a name consisting of a first name, middle name and surname are entered into a mysql database as one thing. Is there a way of breaking this one thing down into the three seperate things and inserting them each into seperate fields of the database.
Update From Single Query
Anyone know if this script is capabale of doing a multiple update in MySQL from a single form? It basically pulls out all the players from a particular team and adds static list boxes for games played/games won. The script works... but am having troubles with this part. code:
Single Qoutes Replacement
How do i insert a row into mySQl from a form, if the inputs of the form contain a '? Don't single qoutes deliminate the array that is being added to the table? for example- How do i make this work? INSERT INTO my_table VALUES(飓', 'Jefferson's house')
Php Esacping Single Quotes
I've been trying to figure this problem out for quite a while and I'm having no joy. I'll give you some background info, I'm creating a form and one of the fields in the form is a big text area that I want to use to write to a text file. This works fine but the problem is all the single quotes are get escaped with slashes. I want to write to the text file with out the quotes getting escaped, I've tried htmlentities but that doesn't seem to work. Here is a snippet of the code. $Desc_file = date("dmYHis"); $Desc_new = htmlentities($desc, ENT_QUOTES); $filePath = "/public_html/nsite/info"; $WriteToFile = fopen("$filePath/$Desc_file","w+"); fwrite ($WriteToFile, $Desc_new); fclose ($WriteToFile);
Single Quotes In MSSQL
I'm trying to deal with user inputs of single quotes into form fields that get input into a MSSQL database. So far I have discovered that if I turn on magic_quotes_sybase in my php.ini file PHP will correctly escape the single quotes. The problem happens when I am trying to retrieve data from the database, PHP will try to comment out what it has already commented out, instead of stripping the extra single quote. So as an example, if someone enters O'Brien as their name into the form PHP send O''Brien to the database to be stored. Now when I have say, a list of users in the database on another page PHP outputs O''''Brien because it is trying to compensate for the single quotes. Is there any sort of function like stripslashes(); but for single quotes?
Can PHP 4 And 5 Coexist On A Single Server?
Our current webserver is a Linux Apache 2 engine running several websites in separate virtual hosts. All of our websites were written for PHP 4, and thus is the version of PHP running. But we are looking to host a copy of MediaWiki which will start to require PHP 5 during the next major release. Since our existing sites are much to large to test and update to run under PHP 5, I want to investigate whether we can install PHP 5 and configure Apache to use PHP 4 for all the existings sites and use PHP 5 for the new one.
Single Array To Multidimensional
I have a string, comma separated, with links and their respective URLs in it. Example: Google,http://www.google.com,Yahoo!,http://www.yahoo.com,WikiPedia,http://www.wikipedia.org etc, etc. i make an array of this with explode( ',', $string ); now what i wonder is how can i turn this array into something like this: $array[0]['name'] = Google $array[0]['url'] = http://www.google.com $array[1]['name'] = Yahoo! $array[1]['url'] = http://www.yahoo.com $array[2]['name'] = WikiPedia $array[2]['url'] = http://www.wikipedia.org I hope/think this is all clear ...
Single Or Double Quotes
Is there a difference between using single quotes (') and double quotes (") in php functions?
When To Use Single Or Double Quotes
I am still confused as when to use single or double quotes. This works: echo "<td>" . $row[0] . "</td>"; and this does not echo "<td bgcolor="#FFFFFF"><font face="Arial" size="1">" . $row[0] . "</font></td>";
How To Delete A Single Field?
I have a database with ten fields for image paths, [imgpath1] [imgpath2] etc. I would like to make a delete button to delete these individually if needed and just have no idea where to start - what is the typical method of deleting just ONE FIELD using a button?
Single ASCII Character
What would be the best way to determine if a single character contained in a variable is a numeral (not an alphabetic or special character)?
Escaping Single/double
I'm having trouble with single and double quote nesting; i know this is wrong, but why? $query = "SELECT CONCAT(client_lname, ', ',client_fname) AS name FROM clients ASC WHERE client_lname = $_POST['editclient']";
Destroying One Single Session
im trying to find a way to destroy one session but i do have multiple active sessions. to delete the one is it like? <?php session_destroy($_SESSION['1']); ?> if nto could anyone tell me what is the command and ill look it up on php.net
Updating A Single File
i want to update a single file some of the info i request is being display except for the picture and the second one is that it is not updating into the database i guess. i have to problem in one Code:
Replace Single Quote Using Preg_match
Since single quotes have security issues during input, I am trying to strip the single quote using preg_match. I am able to replace other characters accept for the single quote. Is the single quote being escaped wrongly? The following is the code snippet.. $patterns[0] = '/'/' $replacements = '' $string = preg_replace($patterns, $replacements, $string);
Exec, Single Quote & Security...
(i'm particulary interested in security issue - php is running on apache + linux) i need to pass the result (here $exp) of a form submission to a third part application using : exec("echo $exp | third_part", $arr, $ret); this $exp may contain simple quote such as in "they're" and if i'm very unlucky harmful code for my system. by now i use : $exp = "'" . implode("' ' '", explode("'", stripslashes($exp))) . "'"; to be sure to maintain single quotes and i also expect to avoid some common vulnerabilities (by enclosing them inside '')
How Save To PNG 8-bit Single-color Transparancy Using GD2?
(PHP4.3.4, GD2) How can I save a PNG using GD2 and insure that it saves as a palette-based (8-bit, 256-color) single-color transparancy?? Saving this way, I could be sure that an image loaded from a transparent gif could be saved as a png and the png would work in IE versions 5.5 and greater (IE has bug that messes up png transparancies which use full alpha channel).
Remove A Single Item From An Array
I have gathered an array of ID's. I need to go throught the array and find a specific ID and remove it from the array. Because we want to keep that ID. Any suggestion of how to do that.
Getting Multiple Emails From A Single Mail()...
I found an old thread on this (http://groups.google.com/group/alt.php/ browse_thread/thread/751edb9c723316c4/ea9bf92a9c6b807c?lnk=gst&q=mail() +duplicate&rnum=7#ea9bf92a9c6b807c), but there didnt seem to be a resolution. I also noticed that this was a pretty old thread and there didn't seem to be anything newer in the search results. Regardless, I have a very similar problem; I am consistently getting five emails per each PHP mail() call. While this originally showed up in a loop generating a flood of email, I explicitly made a single direct mail call using hard coded strings and I confirmed the same behavior. I have spent most of today fighting with this and I can confidently rule out that the mail() function is being accidentally called multiple times (unless PHP is reloading the page multiple times before finally rendering back or something else really bizarre) Here is an example: $result = mail($sendto, $subject, $messagebody, $headers); If it matters, this is being called via a wrapper function, like this: function send_email($email_from, $email_to, $subject, $msg, $show_result = null) { ... $headers = "From: $from "; $headers .= "Reply-To: $from "; ... $result = mail($sendto, $subject, $messagebody, $headers); ... } The values of the vars don't matter, as I ran a very simple mail with hard coded strings and got exactly the same behavior. I have searched extensively and I cant seem to find anything that specifically nails down why this might happen. For those interested in the mail headers generated by a single mail() call, here is what I get (some data scrubbed out): ######################## Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com (SMTPD-9.10) id A208038C; Wed, 01 Aug 2007 12:25:28 -0500 Date: Wed, 01 Aug 2007 12:25:17 -0500 Subject: Subject To: YYYYY.ZZZZZ@MarketNet.com From: AAAAA.BBBBB@MarketNet.com Reply-To: AAAAA.BBBBB@MarketNet.com Message-Id: <200708011225863.SM03756@crazycooter> X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com> Status: X-UIDL: 471469545 X-IMail-ThreadID: c208071f0000b881 ######################## Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com (SMTPD-9.10) id A2020370; Wed, 01 Aug 2007 12:25:22 -0500 Date: Wed, 01 Aug 2007 12:25:11 -0500 Subject: Subject To: YYYYY.ZZZZZ@MarketNet.com From: AAAAA.BBBBB@MarketNet.com Reply-To: AAAAA.BBBBB@MarketNet.com Message-Id: <200708011225800.SM02212@crazycooter> X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com> Status: X-UIDL: 471469541 X-IMail-ThreadID: c20100e10000b872 #######################
The Amazing Escaped Single-quote
Say you have a form with a textarea. Say you type something with single-quotes (e.g. I'm happy so I'm sad) in the textarea. When the textarea is POSTed to a PHP program, are they escaped with the backslash? I ran it on two different servers and one did and one didn't. Why is this? Is there some setting somewhere? Or is this a version diff thing? Here is the PHP code (I changed all angle brackets to square ones so it'll appear): Code:
Reading A Single Line From A File
In asp I can read a text file line by line like this. <% Set fs=Server.CreateObject("Scripting.FileSystemObject") Set f=fs.OpenTextFile(Server.MapPath("FileName.txt"), 1) strLine1 = (f.ReadLine) strLine2 = (f.ReadLine) strLine3 = (f.ReadLine) f.Close Set f=Nothing Set fs=Nothing %> I need to assign line 1 to one variable line 2 to a different variable and so on. Any help is greatly appreciated. Btw, I'm using php4.
Escape Single/double Quotes....
I haven't found a more efficient way to better escape the quote characters for the javascript right from PHP because I only get "The kid" in the javascript alert message, so I'm wondering if anyone of you know of something better than that...Code:
Escaping Single Quotes For MySQL
here's my SQL statement: SELECT item_id, artist, title, format, type FROM music_main WHERE artist = 'Bleu Collar' AND title = 'Makin' The Rounds' PHP is telling me this is invalid. What PHP function would I use to escape the single quote in the title?
Allowing Single Quote In Preg_match
I'm trying to validate text in a HTML input field. How do I *allow* a single quote? // catch any nasty characters (eg !@#$%^&*()/) $match = '/^['w.-_?!, ]+$/' $valid_srch = preg_match($match, $res_description); if (!$valid_srch) { ... } for $match I've also tried: $match = '/^['w.-_?!, ]+$/' $match = '/^["w.-_?!, ]+$/' $match = "/^['w.-_?!, ]+$/"; $match = "/^['w.-_?!, ]+$/"; and numerous other strings but always ' is seen as an invalid character.
Help : Apostrophe/single Quotation Mark
I do not know PHP and write for my friend. He has never been a professional programmer. He studied C and PHP with some books and made a bulletin board for his hobby homepage. (He uses MS-Windows XP) Now, the problem is: Writing a message and previewing is OK. But, after posting, all the words including and after ' (apostrophe/ single quotation mark) disappear. Examples are, -------------------------- I can't do that ==I can --------------------------..................... The person named 'Jim' is smart. ==The person named -----------------------------.............
Question Re Getting A Single Value From A Mysql Database
If I run a mysql query that gets a single field from a row in a database table, what is the easiest way to get the value from the result? I normally do something like this: $query = "SELECT name FROM users WHERE id = 1" $result = mysql_query($query); list($name) = mysql_fetch_row($result); Obviously this is one less line to write than $row = mysql_fetch_row($result); $name = $row['name']; Is there a simpler way than using the list function with a single parameter?
Adding A Single Digit To A Previous One.
Basically what i need to do is get the last entry from table "job_part" WHERE quote_id=$quoteid It will pull a digit, if there was one in the database. I would then like to have text field that is given the value that we just got from the database, and add 1 to it. so if it pulled a "1" it would " + 1" and set the value of the text box to "2" quite simple probably. I just need to have someone show me how it is done. I need to present this to my client today and this is the final step to have it working!. Heres the code for the page. Code:
Apostrophe Or Single Quote In A Blob
i use an apostrophe or single quote in a blob and it returns an error. any message without the apostrophe passes on smooth. is there some escape character or something i need to use for this one?
Single Sign On - Multi Domain
Is it possible to implant single sign on with only using PHP, if so can you give me idea on how to do this? Oh it has to be Multi Domain and also the Domain will be unknown.
|