Re: [PHP-DB] echo
something like this : Inetpub\wwwroot\album\img as I am running out of time! could someone complete this code just with one echo and img src so that I can retrive my photos ? MySQL columns : photoID=seq number photoFileName=name of my photo like 3sw.jpg title=title description=short description ?php $link = mysql_connect('localhost', 'root', 'pw'); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('album', $link); $query = SELECT * FROM photo; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { echo??? } mysql_free_result($result); ? The path would be relative to your web root folder. in your case img src=/album/img/image_name or if you are testing on your own machine use img src=http://localhost/album/img/image_name; or if you need it to work for outside connections : img src=http://your_ip_addres/album/img/image_name; i suggest using the relative path. while ($row = mysql_fetch_array($result)) { echo img src='/album/img/.$row[photoFileName].' / } P.S. Chris sorry for accidentaly sending it only to you the first time.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] help in database design
hi all, i need help in design a database, our office is hospital equipment supplier, we had a list of items, each items had it's own configuration, and each item could consist of several item. we also had contract that have a lot of site, sometimes equipmend that have been ordered different from what the site received, in that case we made a change request... for now we have this |contract|--|has|-|site| | | |item||material| | | |configuration| but i really confused about the Change Request thing, we have to keep both what have been ordered and what have been received... where should i put it, sorri for my bad english tq -- Jangan tanyakan apa yang Indonesia telah berikan pada mu tapi bertanyalah apa yang telah engkau berikan kepada Indonesia -BEGIN GEEK CODE BLOCK- Version: 3.1 GU/IT d- s: a-- C++ UL P L++ E W++ N* o-- K- w PS Y-- PGP- t++ 5 X R++ tv b+ DI D+ G e+ h* r- z? --END GEEK CODE BLOCK-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in database design
what is site mean in here?? - Original Message - From: Suprie [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Wednesday, March 28, 2007 5:03 PM Subject: [PHP-DB] help in database design hi all, i need help in design a database, our office is hospital equipment supplier, we had a list of items, each items had it's own configuration, and each item could consist of several item. we also had contract that have a lot of site, sometimes equipmend that have been ordered different from what the site received, in that case we made a change request... for now we have this |contract|--|has|-|site| | | |item||material| | | |configuration| i rather confused on configuration.. but plz send me a light?? but i really confused about the Change Request thing, we have to keep both what have been ordered and what have been received... where should i put it, sorri for my bad english tq -- -- Table structure for table `rsib_contract` -- CREATE TABLE `rsib_contract` ( `conId` int(11) NOT NULL, `conItemID` int(11) NOT NULL, `conSiteID` int(11) NOT NULL, `conDesc` varchar(100) collate latin1_general_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `rsib_contract` -- -- -- -- Table structure for table `rsib_item` -- CREATE TABLE `rsib_item` ( `itemId` int(11) NOT NULL, `itemName` varchar(45) collate latin1_general_ci NOT NULL, `itemStat` varchar(4) collate latin1_general_ci NOT NULL, `itemDesc` text collate latin1_general_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `rsib_item` -- -- -- -- Table structure for table `rsib_material` -- CREATE TABLE `rsib_material` ( `matId` int(11) NOT NULL, `matName` varchar(34) collate latin1_general_ci NOT NULL, `matDesc` text collate latin1_general_ci NOT NULL, `matItemId` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `rsib_material` -- -- -- -- Table structure for table `rsib_site` -- CREATE TABLE `rsib_site` ( `siteId` int(11) NOT NULL, `siteName` varchar(60) collate latin1_general_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- Jangan tanyakan apa yang Indonesia telah berikan pada mu tapi bertanyalah apa yang telah engkau berikan kepada Indonesia -BEGIN GEEK CODE BLOCK- Version: 3.1 GU/IT d- s: a-- C++ UL P L++ E W++ N* o-- K- w PS Y-- PGP- t++ 5 X R++ tv b+ DI D+ G e+ h* r- z? --END GEEK CODE BLOCK-- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Using apostrophe's within a text field
use mysql_real_escape_string($_POST['field'] IN the query use addslashes use htmlspecialentities use str_replace to switch it to an ascii equivalent hth bastien From: Stephen Smith [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Using apostrophe's within a text field Date: Wed, 28 Mar 2007 00:15:03 -0400 OK guys, here is my delima, which is probably very easy to solve, but I can't seem to find it. I am trying to get form fields to accept apostrophes within the input and stop crashing on me. I'm writing forms into a mysql database and everything works great unless the user enters a word like won't or can't. Them it crashes during the form submit. What can I do to fix this stupid thing anyway? thanks in advance. Steve Smith _ http://local.live.com/?mkt=en-ca/?v=2cid=A6D6BDB4586E357F!420 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] echo
if you view the source of the generated page, is the image name correct? is the path to the image correct? bastien From: elk dolk [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] echo Date: Tue, 27 Mar 2007 22:07:37 -0700 (PDT) Hi all, I am new to web programming. I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them. The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP. What I usually do is to load the images in a folder img and then the name of the pic (i.e. myphoto.jpg) in the database, so i retrieve the name of the pic with: Code: ?php $connex = MySQL_connect(server,login,password); $sql_query = select picname from photos where...; $result = MySQL_query($sql_query,$connex); $row = MySQL_fetch_array($result); ? and then: Code: echo img src=.$row['photoFileName']. alt='photo'; but I can't see the photo Any pointers or code samples will be greatly appreciated... - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. _ RealLiveMoms: Share your experience with Real Live Moms just like you http://www.reallivemoms.ca/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] problems with functions/included files/mysql resource
Hello Neil and Chris, Here are the database-related functions that reside in their own separate file: function connecttodatabase() { global $link_resource; if(!($link_resource=mysql_connect('host', 'user_name', 'password'))) { printf(Error connecting to host %s, by user %s, 'host', 'user_name'); exit(); } if(!mysql_select_db('databasename', $link_resource)) { printf(Error in selecting %s database, 'databasename'); printf(ERROR:%d %s, mysql_errno($link_resource), mysql_error($link_resource)); exit(); } } function runquery($dbquery, $link_resource) { global $result; global $numberRows; $result = mysql_query($dbquery, $link_resource); if (!$result) { printf(Error in executing: %s , $dbquery); printf(ERROR: %d %s, mysql_errno($link_resource), mysql_error($link_resource)); exit(); } else { $numberRows = mysql_num_rows ($result); } } Here is the dropdown list function that lives in a separate file with other dropdown functions in which I use the database functions. function dd_company($company_id = 0) { $dbquery=SELECT id, name from companies where enabled = 'yes' order by name; connecttodatabase(); runquery($dbquery, $link_resource); global $dd_company; $dd_company .= option/option\n; while ($row=mysql_fetch_array($result)) { $dd_company .= Option value=\$row[id]\; if($company_id == $row[id]) { $dd_company .= selected$row[name]/option\n; } else { $dd_company .= $row[name]/option\n; } } } Lastly, I call the dd_company() function with the intent to use the resulting $dd_company dropdown. The error is generated in that last function on the 'runquery($dbquery, $link_resource);' line. So, are you saying that I should be making the $link_resource global in the runquery function instead of the connecttodatabase function? I would like to use the database functions if I can get it right. In the past I've always just included separate files that contained the statements rather than defining functions. That works fine, but I'd rather be able to do it this way. Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In the function to connect to and select the database, I make the mysql-link resource a global value. How are you doing that? Code please :) Obviously change the password etc.. And how are you referencing it in the other files/functions? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] problems with functions/included files/mysql resource
Jvhcom wrote: Hello Neil and Chris, Here are the database-related functions that reside in their own separate file: function connecttodatabase() { global $link_resource; if(!($link_resource=mysql_connect('host', 'user_name', 'password'))) { printf(Error connecting to host %s, by user %s, 'host', 'user_name'); exit(); } if(!mysql_select_db('databasename', $link_resource)) { printf(Error in selecting %s database, 'databasename'); printf(ERROR:%d %s, mysql_errno($link_resource), mysql_error($link_resource)); exit(); } } function runquery($dbquery, $link_resource) { global $result; global $numberRows; $result = mysql_query($dbquery, $link_resource); if (!$result) { printf(Error in executing: %s , $dbquery); printf(ERROR: %d %s, mysql_errno($link_resource), mysql_error($link_resource)); exit(); } else { $numberRows = mysql_num_rows ($result); } } Here is the dropdown list function that lives in a separate file with other dropdown functions in which I use the database functions. function dd_company($company_id = 0) { $dbquery=SELECT id, name from companies where enabled = 'yes' order by name; connecttodatabase(); runquery($dbquery, $link_resource); The problem is here. Inside this function, 'link_resource' doesn't exist. You can change that easily: function dd_company($company_id=0) global $link_resource; $dbquery = SELECT .; Problem solved. Also note that unless you are using multiple database connections in the one script, you don't need to pass around the $link_resource. See http://php.net/mysql_query for more info - If the link identifier is not specified, the last link opened by mysql_connect() is assumed. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in database design
Suprie wrote: hi all, i need help in design a database, our office is hospital equipment supplier, we had a list of items, each items had it's own configuration, and each item could consist of several item. we also had contract that have a lot of site, sometimes equipmend that have been ordered different from what the site received, in that case we made a change request... for now we have this |contract|--|has|-|site| | | |item||material| | | |configuration| but i really confused about the Change Request thing, we have to keep both what have been ordered and what have been received... where should i put it, sorri for my bad english Why does that have to fit into this scheme? Why can't it be separate? create table change_requests ( request_id primary key .. blah blah, item_ordered text, item_order_date timestamp, // so you know when you ordered it item_received text, item_receive_date timestamp // so you know when you received it. ); problem solved ? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] help in database design
NOT QUITE..ups.. my bad - Original Message - From: Chris [EMAIL PROTECTED] To: Suprie [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Thursday, March 29, 2007 6:53 AM Subject: Re: [PHP-DB] help in database design Suprie wrote: hi all, i need help in design a database, our office is hospital equipment supplier, we had a list of items, each items had it's own configuration, and each item could consist of several item. we also had contract that have a lot of site, sometimes equipmend that have been ordered different from what the site received, in that case we made a change request... for now we have this |contract|--|has|-|site| | | |item||material| | | |configuration| but i really confused about the Change Request thing, we have to keep both what have been ordered and what have been received... where should i put it, sorri for my bad english Why does that have to fit into this scheme? Why can't it be separate? well as u mention above.. he already seperated while ago.. item and material was 2 different table. and yet it should seperated.. i alreadt received the newest.. i hope he posted but i posted again == site is, the items destination , owh i forgot beside the goods we also provide services, that could change also just like other items depends the situation. = as i write above.. he mistaken on what the flow goes create table change_requests ( request_id primary key .. blah blah, item_ordered text, item_order_date timestamp, // so you know when you ordered it item_received text, item_receive_date timestamp // so you know when you received it. ); problem solved ? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help creating tables and fields
Team, I am in need of your help. I have tried over the years to do this. But, I seem not to be able to get it to the way I want. I want to start from scratch. What I want to do is build site that has team management for your roster of players, and display stats in a nut shell. As far as stats, I have about 5 years worth of data that I want to store in a database. I want to display it by all means. Years, players, teams etc. Then, I also want to be able to manage the players and the teams only with the current active year. My wish list is here: http://www.theufl.com/ufl_project.htm Please email privately if needed. This is a dream of mine to finish for my website. I want to do all the work and learn it. I know of databases just never really gone all out on one. Can you please tell me what tables and fields I would need in order to do this. I have a word doc going that shows a projected database. If you are interested in seeing it please let me know so I can email you off the list, as I am not able to send out attachments. :-) Your alls help would be greatly appreciated Karl Karl James (TheSaint) mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] www.theufl.com http://www.theufl.com/
[PHP-DB] XAMPP InnoDB Issue
Hi All, Any one have experiance on using XAMPP with configure MySQL InnoDB engine. This is my.cnf configuration settings, but it not working = # skip-innodb # Uncomment the following if you are using InnoDB tables innodb_data_home_dir = C:/Program Files/xampp/mysql/data/ innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = C:/Program Files/xampp/mysql/data/ innodb_log_arch_dir = C:/Program Files/xampp/mysql/data/ # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high set-variable = innodb_buffer_pool_size=16M set-variable = innodb_additional_mem_pool_size=2M #Set .._log_file_size to 25 % of buffer pool size set-variable = innodb_log_file_size=5M set-variable = innodb_log_buffer_size=8M innodb_flush_log_at_trx_commit=1 set-variable = innodb_lock_wait_timeout=50 = Thankx, Lasitha DOTW DISCLAIMER: This e-mail and any attachments are strictly confidential and intended for the addressee only. If you are not the named addressee you must not disclose, copy or take any action in reliance of this transmission and you should notify us as soon as possible. If you have received it in error, please contact the message sender immediately. This e-mail and any attachments are believed to be free from viruses but it is your responsibility to carry out all necessary virus checks and DOTW accepts no liability in connection therewith. This e-mail and all other electronic (including voice) communications from the sender's company are for informational purposes only. No such communication is intended by the sender to constitute either an electronic record or an electronic signature or to constitute any agreement by the sender to conduct a transaction by electronic means. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] XAMPP InnoDB Issue
This is my.cnf configuration settings, but it not working What isn't working exactly? Mysql? Connections from php? Something else? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php