[PHP-DB] Pulling data - stops at spaces
Hello, I am sort of new to php and mysql (in regards to experience with it as a programmer), so my apologies for the silly questions :) I am trying to pull text that was entered into a table. See code below. The only problem seems to be with lines like this: $rows .= 'trtd colspan=3Video Title:/tdtdinput name=video_title value='.$row['video_title'].' type=text maxlength=60/td/tr'; Say the title is the title, it only pulls out the. I am wondering if I am using the wrong method for pulling the data, or if I should correct the way I am doing it. Looking at php.net I see these: http://www.php.net/manual/en/ref.msql.php Any suggestions for an alternative method? thank you for your help :) Andres /* Connecting, selecting database */ $link = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die(Could not connect : . mysql_error()); mysql_select_db($mysql_db) or die(Could not select database); /* Performing SQL query */ $query = SELECT * FROM video where video_id=$video_id; $result = mysql_query($query) or die(Query failed : . mysql_error()); $query2 = SELECT * FROM artist; $result2 = mysql_query($query2) or die(Query failed : . mysql_error()); /* Converting result of ad_type query into array */ if ($result) { $row = mysql_fetch_array($result); $rows .= 'trtd colspan=3Video ID:/tdtdnbsp;'.$row['video_id'].'/td/tr'; $rows .= 'trtd colspan=3input name=video_id value='.$row['video_id'].' type=hidden size=20/td/tr'; $rows .= 'trtd colspan=3Video Title:/tdtdinput name=video_title value='.$row['video_title'].' type=text maxlength=60/td/tr'; $rows .= 'trtd colspan=3Recording Label:/tdtdinput name=video_lable value='.$row['video_label'].' type=text maxlength=60/td/tr'; $rows .= 'trtd colspan=4bHTML Attributes/b/td/tr'; $rows .= 'trtd colspan=3Title - HTML Tag:/tdtdinput name=html_title value='.$row['html_title'].' type=text maxlength=60/td/tr'; $rows .= 'trtd colspan=3Video URL:/tdtdinput name=video_url value='.$row['video_url'].' maxlength=60/td/tr'; $rows .= 'trtd colspan=3Keywords - Meta Tag:/tdtdtextarea name=html_title value='.$row['video_meta_keywords'].' maxlength=847/textarea/td/tr'; $rows .= 'trtd colspan=3Description - Meta Tag:/tdtdtextarea name=html_title value='.$row['video_meta_description'].' maxlength=150/textarea/td/tr'; $rows .= 'trtd colspan=3Abstract - Meta Tag:/tdtdtextarea name=html_title value='.$row['video_meta_abstract'].' maxlength=150/textarea/td/tr'; $rows .= 'trtd colspan=4bGenres Below (more than one can be selected)/b/td/tr'; $rows .= 'trtdElectronica:/tdtd colspan=3input type=checkbox name=video_category_electronica/td/tr'; $rows .= 'trtdRock:/tdtd colspan=3input type=checkbox name=video_category_rock/td/tr'; $rows .= 'trtdHipHop:/tdtd colspan=3input type=checkbox name=video_category_hiphop/td/tr'; $rows .= 'trtdEclectic:/tdtd colspan=3input type=checkbox name=video_category_eclectic/td/tr'; $rows .= 'trtdHumor:/tdtd colspan=3input type=checkbox name=video_category_humor/td/tr'; $rows .= 'trtdOther:/tdtd colspan=3input type=checkbox name=video_category_other value='.$row['video_category_other:q'].'/td/tr'; } /*Converting result of artist query into array */ if($result2){ $num_rows2 = mysql_num_rows($result2); for($i=0;$i$num_rows2;$i++){ $row2 = mysql_fetch_array($result2); $artist_choice .= 'option value='.$row2['artist_id'].''.$row2['artist_name']; } } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Pulling data - stops at spaces
Awesome, putting quotes worked!!! Thanks a lot Brad and Bastien :) Bastien Koert wrote: -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] pagination problem
Hi all, I have a MySQL database full with authors and titles. I made a script that searchs a specific author and return the all his books titles, but I need it show the results from 10 to 10. I tried with LIMIT and it return just fine the first 10 but when I click the next 10 button it show me other 10 registers but from all the database not from the author selection I choosed. So I think it only reads the variable I send from the form once, the second time it seems not to read the author I want to find. The code is this: ?php $buscar = $HTTP_GET_VARS['buscar']; $conex = @mysql_connect(localhost, root, ); @mysql_select_db(boc, $conex); if (!isset($_GET['page'])){ $page = 1; }else{ $page = $_GET['page']; } $num_result = 8; $from = (($page * $num_result) - $num_result); $sql = SELECT * FROM boletines WHERE (author LIKE '%$buscar%') LIMIT $from, $num_result; $res = mysql_query($sql, $conex); if (!isset($tot)){ $totquery = SELECT * FROM boletines WHERE (author LIKE '%$buscar%'); $tot = mysql_query($totquery, $conex); } $total_results = mysql_num_rows($tot); if (mysql_num_rows($res)==0){ echo 0 RESULTS; }else{ echo $total_results. RESULTS FOUNDED; echo TABLE; echo TRTDAUTHOR/TD; echo TDTITLE/TD; echo TDPAGES/TD; echo TDVOL/TD/TR; while ($row = mysql_fetch_array($res)){ echo TRTD.$row[Author]./TD; echo TD.$row['Title']./TD; echo TD.$row['pages']./TD; echo TD.$row['Vol']./TR; } echo /TABLE; } //previous link $total_pages = ceil($total_results / $max_results); if ($page 1){ $prev = ($page - 1); echo a href=\.$_SERVER['PHP_SELF'].?page=$prev\Previous/anbsp;; } for($i = 1; $i = $total_pages; $i++){ if(($page) == $i){ echo $inbsp;; } else { echo a href=\.$_SERVER['PHP_SELF'].?page=$i\$i/anbsp;; } } // next link if($page $total_pages){ $next = ($page + 1); echo a href=\.$_SERVER['PHP_SELF'].?page=$next\Next/a; } ? I would appreciate any help. I'm a newby, so be the most especific you can...Many thanks guys. Andres -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mysql database function problem
Thanks, it works...mysqlerror() told me the exact problem and I could solve it thanks David Robley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Hello Everybody! I tried to connect with a mysql databasem , but It shows the follow error: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 25 Número de filas en el resultado: Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 29 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 32 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 40 It seems doesn't recognize the mysql functions I wrote in the code, or did I something wrong? I'm a newbie trying to learn and I have php 4.3.2 with mysql 4.0.13 in a windows xp with ISS 5.0 and I've Installed those programs a lot of times trying to fix it up but the problem remains. I'll really appreciate any help. The problem is most likely in the syntax of your query. Use mysql_error() immediately after sending your query to the db to get an error string from mysql. -- Quod subigo farinam $email =~ s/oz$/au/o; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql database function problem
Hello Everybody! I tried to connect with a mysql databasem , but It shows the follow error: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 25 Número de filas en el resultado: Warning: mysql_num_fields(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 29 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 32 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\ejercicios\cap11\cursor.php on line 40 It seems doesn't recognize the mysql functions I wrote in the code, or did I something wrong? I'm a newbie trying to learn and I have php 4.3.2 with mysql 4.0.13 in a windows xp with ISS 5.0 and I've Installed those programs a lot of times trying to fix it up but the problem remains. I'll really appreciate any help. Andres -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Men enought for this? LDAP, SSL, Active Directory
Hi NG Users, I have sent this message to php.general too, but didn't get any response there. It looks like this is all to new for most of the readers... Since LDAP is some kind of db too, I thaught I'd send it to php.db... I'm implementing some php 4.2.x code to manipulate Microsofts Active Directory. I have already set-up the domain controller to handle LDAP over SSL (Port 636) and it looks like it is working, at least I can download a certificate when I browse the server with HTTPS. The problem now is to get the certificate into php. Does anyone have some clues how to manage this? Basically, what I'm trying to do is to build a web-frontend to change passwords for AD accounts. I wouldn't like to re-invent the wheel, so I'd really appreciate if someone could post some code samples. Also, if somebody already knows about some working ASP (VB) code, that would also be very much appreciated. Anyway, it would be important to at least be able to authenticate users agains AD with php, what probably means that I still have to set-up a PHP/LDAP over a SSL connection to AD. If anyone knows how to get a certificate into PHP, so that it is possible to connect with something like this $ds = ldap_connect(ldaps://servername:636); that would be really great. I've been browsing a lot on the web now and I really have tried almost any search combinations with google and other search engines, but I couldn't find any usefull docs on this topic. There are many people looking into this issue, but finally most of them seem to fail when it comes to connect to AD over SSL. If someone here has experience in this field, I think he could do a favour to lots of developers, since it looks like this is a major problem when it comes to interoperability between Win2k and common Unix systems. Should I be successful in my research, I really would be willing to write a decent documentation about this, so that others wont have to waste so much time again, like others did on this topic. Kind regards to everyone, Andres -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP-DB] Men enought for this? LDAP, SSL, Active Directory
have you tried yet? $ad = ldap_connect('ldaps://your.ldap.server', 636); $bound = ldap_bind($ad, 'somebinddn', 'somepasswd'); worked out of the box, using it manage over 20,000 users at a university...can authenticate and change passwords, etc. Sure, I tried this. Do you possibly know how PHP gets a certificate to communicate over SSL? I mean, it looks like the secure channel cannot be estabilished. Do you know what has to be provided on the Active Directory's side? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL Connection FailedL
Hi, I'm trying to get IRM to work with my MySQL server. IRM uses php3. It worked for a bit (entry 30 form the MySQL log as shown below). Suddenly, affter fidling with (i believe this is what it was) the file php.ini I know get this: Warning: MySQL Connection Failed: Access denied for user: 'apache@localhost' (Using password: NO) in ./irm.inc on line 83 Warning: MySQL Connection Failed: Access denied for user: 'apache@localhost' (Using password: NO) in ./irm.inc on line 84 Warning: MySQL: A link to the server could not be established in ./irm.inc on line 84 The MySQL log files say this: 010916 7:06:03 30 Connectapache@localhost on 30 Init DBirm 30 Query SELECT * from users where (name = 'admin' password = 'admin') 30 Query SELECT * FROM prefs WHERE (user = 'Admin') 30 Quit 010916 7:10:36 31 ConnectAccess denied for user: 'apache@localhost' (Using password: YES) I tried using the database with the user and password and it worked. For some reason I think that there is a miscommunication between the php page and mysql in that php says Using password: NO and MySQL says Using password: YES. I cannot remember what I changed unfortunately :( Has anyone encountered this before who can give me a freindly tip? Andres -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]