Re: [PHP-DB] Individual Array Entries
Here's how you can fill a multi-dimensional array: $days = array(); //Declare $days to be an array while ($row = mysql_fetch_assoc($result)) //set variable $row to be an associative array containing a row of results from your mysql query array_push($days, $row); //Inserts a new record into $days and stores $row in it. This creates a multi-dimensional array Or, if you want it associative: $days = array(); while ($row = mysql_fetch_assoc($result)) $days['whatever here'] = $row; Hope that helps! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with passing variable to mssql
William Curry wrote: $qry1 = SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as MYDATE from PcarsCallComplete where Location_address = .$Location2. order by CALL_NO; This method usually works well for me for debugging purposes: immediately prior to query, echo it to see exactly what you're telling mysql and then exit the script so it's the only output. Log in to mysql as the user that your script is logging in as (just in case it's a permission setting) Enter sql via copy paste Check results. So, for you: echo \$qry1 = \SELECT *,CONVERT(Char(24),CALL_ENTRY_DATE,101) as MYDATE from PcarsCallComplete where Location_address = $Location2 order by CALL_NO\;; Enter output into mysql (obviously only the code between the quotes) and run query. Be sure you're logged in as the same user that the script logs in with, else you may have different privileges! If you don't receive an error or an empty set in mysql, then it could be something simple yet hard to diagnose. Perhaps you're inserting (and logging directly in) to a different database than your script is reading from (such as if you have multiple comps on your network acting as servers, perhaps you're trying to select from the wrong machine's database). Thanks, Jim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mailto and PHP
Phil Matt wrote: De-lurking here. I am trying to modify a mailing script that I originally wrote to use a small form to send mail to different people from a MySQL database. I would like to modify it so that instead of using a form, the user's regular default email program opens on activating the link. I can't quite figure out how to pass the right parameters. Here's the relevant part of the existing script: echo'tr class=shader'.$line.'a td'.$myrow[0].'/tdtd'.$myrow[1].'/tdtd'.$myrow[2].'/td td'. $myrow[4].'/td tda href=NEWmail.php?id='.urlencode($myrow[6]).'recip='.urlencode($myrow[0]. .$myrow[1].,br / .$myrow[2]).'img src=somegraphic.gif class=imglink width=20 height=17 alt=Click to send mail to this person //a/td/tr'; I want to change the link to mailto: instead of the other PHP page, and then pass the recipient email address and recipient name and title, which are already there from the MySQL connection. I've looked around for the right syntax, but it just escapes me. I have the Welling Thompson book, but it only mentions that this can be done, without a clue as to how to do it. Pardon my ignorance, but this is not my area of expertise. TIA for your collective wisdom! --- P. Matt I think this is what you want: http://www.ianr.unl.edu/internet/mailto.html HTH! -- Thanks, Jim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Read more link with HTML code
Hmmm... Perhaps you should think about separating the tags from the content? Do something like: //Strip tags from content and add a few char hook to be used for re-insertion //Count 200 chars (ignoring any hooks found while parsing and thereby not adding it to the char count) //Make sure last char is a space or something appropriate //re-insert tags over the hooks (count tags used tags closed) //close any inserted tags that aren't closed already in nested order Mike van Hoof wrote: Hello list, I got a problem with displaying content in a read more block which contains HTML code. The problem is as followes: I got a large piece of content, which contains HTML code (bui etc), but after 200 characters a read more link appears. At the moment I strip al the HTML out of this piece of content, and display the full set off content on another page. But now i also want to display the bold text etc. in the first (200 chrs) content block. The only problem i have here, is that when I got a bold tag opend in the first 200 chrs, and it's closed after 400 chrs, then the rest off the page is also bold. somebody got a solution ? Thanks for reading. Mike -- Thanks, Jim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variable with NULL value
OKi98 wrote: Hi, one more question. Why the variable, that contains NULL value appears to be not set. When you try to echo it the php does not produce warning about using undefined variable. //$connection contains database connection handler $result=mysql_query(select NULL as value,$connection); $tmp=mysql_fetch_array($result); $foo=$tmp[value]; if (!isset($foo)) echo(\$foo is not set but does not produce warning -$foo-); OKi98 Someone correct me if I'm wrong but it appears that you should be using if(!isset($tmp[value]) before assigning to $foo if you want to ensure that $foo will, indeed, be set. -- Thanks, Jim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and MYSQL
Chris wrote: Na Derro Cartwright wrote: I am currently running php4 with mysql 5. when I try to run a query using the mysql command I recieve and error that reads the resource id and a number. What does that mean? Firstly always cc the list - others will be able to provide their input and others will also learn from the problem/resolution. What is the query? What is the error? If you run it manually through command line mysql or phpmyadmin do you get an error? You're probably doing something like: //Open connection and database $handle = mysql_connect($host, $user, $pass); mysql_select_db($database); //Run query $result = mysql_query(SELECT foo FROM bar); //Close connection mysql_close($handle); //Show result echo $result; The correct way to do this is: //Open connection and database $handle = mysql_connect($host, $user, $pass); mysql_select_db($database); //Run query $result = mysql_query(SELECT foo FROM bar); //use resource id returned from query to fetch actual results (note that the 0 is a line number so in the case you have more than 1 result you'll have to use a different method such as mysql_fetch_assoc or something I'd advise you take a look at the documentation @ php.net) $result = mysql_result($result, 0); //Close connection mysql_close($handle); //Show result echo $result; -- Thanks, Jim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [css-d] IE5.5 and td[scope]
D. D. Brierton wrote: On Wed, 2007-05-02 at 16:24 +0100, Martin Paton wrote: I'm using ... #contactform table td[scope] {width:50%} ... to set the width of the label column of a form. Does IE 5.5 support this because I can't get it to pick up (or is there a workaround?) No, IE5.x doesn't support attribute selectors. I don't believe IE6 does either. Not sure about IE7. The workaround is to give the td elements in question a class. Supposedly IE7 does support attribute selectors (as well as many other advanced selectors) but I've stuck to the older styles for now until the other versions of IE drop out of mainstream usage. -- Thanks, Jim