Re: [PHP-DB] Books

2010-10-18 Thread mrfroasty
 1.PHP Objects,Patterns, and Practice
2.Pro PHP Patterns, Frameworks,Testing and More

MySQL:
1.MySQL Cookbook

html/css no idea, I dont have good ideas of designing even if I become
fluent in css.But its handy to know css just how it generally works and
its place on the webAnyways, dont listen to me, I am more of a
programmer rather than web-developerSo my first starting point was
PHP, and along the way I am becoming fluent on the rest of the web-tools.

Its nice I think to know your interests Server Side or Frontend.If you
intend to be Server Side Dev, then HTML  PHP  MySQL are the starting
point.Frontend you should start off with CSS,HTML , Javascript.etc.

Gr
Muhsin


On 10/18/2010 04:06 PM, Ethan Rosenberg wrote:
 Dear List -

 I posted part of this question on the general list.  I am posting here
 just in case this list did not see the post.  This should NOT be taken
 as any type of negative reference to the general list, the members of
 which have furnished me excellent help.

 Question:

 What books would your recommend to learn HTML/CSS, MySQL and PHP?  The
 books should start from the basic level and proceed to the
 intermediate/advanced level.

 Thanks.

 Ethan





-- 
Extra details:
OSS:Gentoo Linux
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://www.mzalendo.net
url:http://www.zanbytes.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: Need help-Send email

2009-09-12 Thread mrfroasty
Is this related to PHP-DB?
Anyways, if I understands it correctly is that mail() is working but the
client is categorizing the mail received into the SPAM folder.This might
means your issue is not longer on that mail(), but on the your
mail-client filters.

GR
mrfroasty


nagendra prasad wrote:
 Hi all,

 Below is the code that I have coded after replies from all of you. But
 before that I want to thank all of you for your help. I have coded the email
 code but still it is giving me an error. Please help me.

 ?php

 //sending email script

 $to = exam...@gmail.com;
 $subject = Email from admin;

 if ($_POST['submit'])
 {
 //get data from form

 $name = $_POST['name'];
 $message = $_POST['message'];
 if ($name$message)
 {
 $namelen = 20;
 $messagelen = 300;
 if (strlen($name)=$namelen  strlen($message)=$messagelen)
 {
   //everything is ok

   ini_set(SMTP, smtp.gmail.com);


$to = exam...@gmail.com;

$subject = Email from admin;
$header = from: exam...@gmail.com;


$body = Email from $name \n\n $message;


mail($to,$subject,$body,$header);
die();
 }
 else
 die (Max length of name is $namelen, and max length for message is 300);

 }
  else
  die(you must enter a name);
 }

 ?

 html
   form action='sendemail.php' method='POST'
 Name: input type='text' name='name' maxlenght='20'br
 Message: brtextarea name='message'/textareap
 input type='submit' name='submit' value='Send an email'

   /form



 /html
 --

 Also I have simplified the code by just using the email() function but the
 problem is its sending the mail in the SPAM. The code is below :

 ?php
 $to = exam...@gmail.com;
 $subject = Test mail;
 $message = Hello! This is a simple email message.;
 $from = exam...@gmail.com;
 $headers = From: $from;
 mail($to,$subject,$message,$headers);
 echo Mail Sent.;
 ?

   


-- 
Extra details:
OSS:Gentoo Linux
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://www.mzalendo.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SELECT LIKE with % and without %

2009-05-02 Thread mrfroasty
Emiliano Boragina wrote:
 Hello.

 I am using this:
 $sql = SELECT * FROM table WHERE ID LIKE '%$_GET[id]%' AND title LIKE
 '%$_GET[word]%';
   
This doesnt work?

$sql = SELECT * FROM table WHERE ID='some_id' AND title='some_title';



-- 
Extra details:
OSS:Gentoo Linux
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://mambo-tech.net
url:http://blog.mambo-tech.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Please help a newbie

2009-04-19 Thread mrfroasty

Hello,

May be try something like this:

$query1=
CREATE TABLE contacts(
id int(16) NOT NULL auto_increment,
phone varchar(15)  NOT NULL,
name varchar(15) NOT NULL,
address varchar(15) NOT NULL,
PRIMARY KEY (id)
);

$query2 = INSERT INTO contacts VALUES ('NULL','$phone', '$name', 
'$address');


P:S
id incremented automatically by MYSQL now

GR
mrfroasty



Rij wrote:

Hello,

I am new to the world of PHP and MySQL. My objective is to create a
table, insert values in it and read it back.

Here's the partial code to create a table from a PHP file:

if (!$table_exists) {
$query=CREATE TABLE contacts (id int(20) NOT NULL, name
varchar(15) NOT NULL, address varchar(15),PRIMARY KEY(id)
if (mysql_query($query, $con)) echo Table contacts created;
else die('Unable to create table : '.mysql_error());
}


I input the values from a HTML form. Here is the partial code.
$phone = $_POST['phone'];
$name  = $_POST['name'];
$address = $_POST['address'];
$query = INSERT INTO contacts VALUES ('$phone', '$name', '$address');
if (mysql_query($query, $con)) echo Values inserted;
else die('Unable to create table : '.mysql_error());


Now the problem that I am facing is that when I make my first insert,
the id field shows a garbage value and not the number that I entered.
Subsequent entries into the table show up just fine. It's only the
first one.

What am I doing wrong?

Thanks, Rij

  



--
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://mambo-tech.net
url:http://blog.mambo-tech.net


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Retrieving Image Location in MySQL

2009-03-07 Thread mrfroasty
Hello,

Does something like this work on your php script?

$location=..\..\Bldgs_lots\Burruss.jpg

OR

$location=..\Bldgs_lots\Burruss.jpg




GR
Muhsin



Sashikanth Gurram wrote:
 This is the location where I have saved  my images.
 /C:\Users\Sashikanth\Desktop\Bldgs_lots\Burruss.jpg
 /I have loaded the above location exactly into my database. But when I
 call it using

 /echo img src='$location' border='1' height='150' width='200'
 alt='$build' ;/

 It is simply giving me some blank empty space, with the name of the
 picture in the blank space (Since I am using alt). So, as I see it,
 the retrieval part is working fine, but the displaying of the image is
 not functioning properly. I am using a WAMP server. Any kind of
 suggestions are welcome.

 Thanks,
 Sashi

 PS: For Reference, I am posting my entire code below again. The image
 retrieval part is towards the end of the code.

 /html
 body
 form action=mysqli.php method=post
 br
 div align=center
 Building Name:select name=name
 option value= Select a Building/option
  option value=Military BuildingMilitary Building/option
  option value=Monteith HallMonteith Hall/option
  option value=New Residence Hall-Career Services SiteNew
 Residence Hall-Career Services Site/option
  option value=Williams HallWilliams Hall/option
  option value=Women's Softball FieldWomen's Softball
 Field/option
  option value=Wright HouseWright House/option
 /select
 /div
input type=submit /
 /form
 img src=mysqli.php?

 ?php
 // Connects to your Database
 $host=**;
 $user=***;
 $password=;
 $dbname=*;
 $cxn=mysqli_connect($host, $user, $password, $dbname) ;
 if (!$cxn=mysqli_connect($host, $user, $password, $dbname))
{
$error=mysqli_error($cxn);
echo $error;
die();
}
 else
{
echo Connection established successfully;
}
 //Define the variables for Day and Month
 $Today=date(l);
 $Month=date(F);
 $build=$_POST[name];
 $low_speed=2.5;
 $high_speed=4;
 $hour=date(G);
 $minute=date(i);
 if ($minute=00  $minute=14)
{
$minute=00;
}
 elseif ($minute=15  $minute=29)
{
$minute=15;
}
 elseif ($minute=30  $minute=44)
{
$minute=30;
}
 else
{
$minute=45;
}
 $times=10:$minute;
 $sql=SELECT buildingname, parking_lot_name, empty_spaces, distance,
 round(distance/($low_speed*60),1) AS low_time,
 round(distance/($high_speed*60),1) AS high_time, Location FROM
 buildings, buildings_lots, parkinglots, occupancy2, Image where
 (buildings.buildingcode=occupancy2.building AND 
 buildings.buildingcode=buildings_lots.building_code AND
 parkinglots.parking_lot_code=buildings_lots.parking_lot_code AND
 parkinglots.parking_lot_code=occupancy2.parking_lot AND
 Buildings.BuildingCode=Image.BuildingCode) AND buildingname='$build'
 AND month='$Month' AND day='Monday' AND Time='$times';
 $data = mysqli_query($cxn,$sql);
 if (!$data=mysqli_query($cxn,$sql))
{
$error=mysqli_error($cxn);
echo $error;
die();
}
 else
{
echo br;
echo Query sent successfully;
}
 echo br;
 echo h1 PARKING LOT INFORMATION h1;
 echo table border='1' cellspacing='5' cellpadding='2';
 echo tr\n
thBuilding/th\n
thParking Lot/th\n
thEstimated Number of Empty Spaces/th\n
thDistance (Feet)/th\n
thEstimated walking time to the building/th\n
/tr\n;
 while ($row=mysqli_fetch_array($data))
{
extract($row);
 $building = $row[0];
  $parking_lot = $row[1];
  $Number_of_Empty_Spaces = $row[2];
  $Distance = $row[3];
  $time_l = $row[4];
  $time_h=$row[5];
  $location=$row[6];   echo tr\n
  td$building/td\n
  td$parking_lot/td\n  
 td$Number_of_Empty_Spaces/td\n
  td$Distance/td\n
  td$time_h - $time_l mins/td\n
 td$location/td\n
  /tr\n;
}
echo /table\n;
 echo img src='$location' border='1' height='150' width='200'
 alt='$build' ;
 ?
 /body
 /html/


 mrfroasty wrote:
 Hello,

 It might be something with location where the script  is located and the
 image.I think is normally the case if they arent on the same
 directory...
 If not you might want to try saving your image locations with something
 like ../../image_folder/image.jpg

 I am not sure though as I have seen this  issue on one application but
 it runs on LAMP

 P:S
 ../ One step back from the script location


 GR
 Muhsin


 Sashikanth Gurram wrote:
  
 Hi,
 Thanks a lot for the suggestion. It is working fine but there is some
 problem. When I introduced the piece of code you have suggested into
 my code, I am getting a space for the picture but nothing is there in
 that space. It is just blank. I do not know the reason for this. I am
 just attaching a picture just in case it might give you a better idea.
 Further, this is the piece of code I have written to display the pic.

 /echo img src='$location

Re: [PHP-DB] Retrieving Image Location in MySQL

2009-03-06 Thread mrfroasty

Hello,

Storing only location of the image in dB wouldnt be any different than
other string/data retrieved from the dB.That means if you have something
like this in html documents whereby $image_location comes from the dB
It should work without header stuffs

Example
img src=$image_location border=1 height=150 width=200
alt=Image ISMAP
P:S
Replace $image_location with image location from your dB.


GR
Muhsin



Sashikanth Gurram wrote:
 Dear all,

 I have been trying to retrieve the location of a image from database
 and display the image in the browser using PHP. I have written a sort
 of code for the purpose. All I am getting in my browser after using
 the code is a long set of ASCII characters with the following warning
 *Warning*: Cannot modify header information - headers already sent by
 (output started at C:\wamp\www\mysqli.php:65) in
 *C:\wamp\www\mysqli.php* on line *237
 *
 I am herewith attaching my code. If anyone can  point out the error or
 give some kind of advice that would be really great. The location of
 the image is stored in a table by the name IMAGE under the column name
 Location and here in the code, the location is retrieved under the
 varibale name $Location.

 thanks,
 Sashi

 /html
 body
 form action=mysqli.php method=post
 br
 div align=center
 Building Name:select name=name
 option value= Select a Building/option
 option value=Agnew HallAgnew Hall/option
  option value=Rector Field HouseRector Field House/option
  option value=Richard B. Talbot Educational Resources
 CenterRichard B. Talbot Educational Resources Center/option
  option value=Robeson HallRobeson Hall/option
  option value=Sandy HallSandy Hall/option
  option value=Saunders hallSaunders hall/option
  option value=Seitz HallSeitz Hall/option
  option value=Shanks HallShanks Hall/option
  option value=Shultz HallShultz Hall/option
  option value=Skelton Conference CenterSkelton Conference
 Center/option
  option value=Williams HallWilliams Hall/option
  option value=Women's Softball FieldWomen's Softball
 Field/option
  option value=Wright HouseWright House/option
 /select
 /div
input type=submit /
 /form
 img src=mysqli.php?

 ?php
 // Connects to your Database
 $host=***;
 $user=*;
 $password=**;
 $dbname=***;
 $cxn=mysqli_connect($host, $user, $password, $dbname) ;
 if (!$cxn=mysqli_connect($host, $user, $password, $dbname))
{
$error=mysqli_error($cxn);
echo $error;
die();
}
 else
{
echo Connection established successfully;
}
 //Define the variables for Day and Month
 $Today=date(l);
 $Month=date(F);
 $build=$_POST[name];
 $low_speed=2.5;
 $high_speed=4;
 $hour=date(G);
 $minute=date(i);
 if ($minute=00  $minute=14)
{
$minute=00;
}
 elseif ($minute=15  $minute=29)
{
$minute=15;
}
 elseif ($minute=30  $minute=44)
{
$minute=30;
}
 else
{
$minute=45;
}
 $times=$hour:$minute;
 $sql=SELECT buildingname, parking_lot_name, empty_spaces, distance,
 round(distance/($low_speed*60),1) AS low_time,
 round(distance/($high_speed*60),1) AS high_time, Location FROM
 buildings, buildings_lots, parkinglots, occupancy2, Image where
 (buildings.buildingcode=occupancy2.building AND 
 buildings.buildingcode=buildings_lots.building_code AND
 parkinglots.parking_lot_code=buildings_lots.parking_lot_code AND
 parkinglots.parking_lot_code=occupancy2.parking_lot AND
 Buildings.BuildingCode=Image.BuildingCode) AND buildingname='$build'
 AND month='$Month' AND day='$Today' AND Time='$times';
 $data = mysqli_query($cxn,$sql);
 if (!$data=mysqli_query($cxn,$sql))
{
$error=mysqli_error($cxn);
echo $error;
die();
}
 else
{
echo br;
echo Query sent successfully;
}
 echo br;
 echo h1 PARKING LOT INFORMATION h1;
 echo table border='1' cellspacing='5' cellpadding='2';
 echo tr\n
thBuilding/th\n
thParking Lot/th\n
thEstimated Number of Empty Spaces/th\n
thDistance (Feet)/th\n
thEstimated walking time to the building/th\n
/tr\n;
 while ($row=mysqli_fetch_array($data))
{
extract($row);
 $building = $row[0];
  $parking_lot = $row[1];
  $Number_of_Empty_Spaces = $row[2];
  $Distance = $row[3];
  $time_l = $row[4];
  $time_h=$row[5];
  $location=$row[6];   echo tr\n
  td$building/td\n
  td$parking_lot/td\n  
 td$Number_of_Empty_Spaces/td\n
  td$Distance/td\n
  td$time_h - $time_l mins/td\n
 td$location/td\n
  /tr\n;
}
echo /table\n;
 $err=1;
 if ($img = file_get_contents($location, FILE_BINARY))
 {
  if ($img = imagecreatefromstring($img)) $err = 0;
 }
 if ($err)
 {
  header('Content-Type: text/html');
  echo 'htmlbodyp style=font-size:9pxError getting
 image.../p/body/html';
 }
 else
 {
  header('Content-Type: image/jpeg');
  imagejpeg($img);
  

[PHP-DB] re:looking for SQL documentation tool

2009-03-04 Thread mrfroasty
Hello guysis there any tool that can create data relation from sql
document?I have seen phpmyadmin, but still I am looking for other
software to see what they have to offer...

Thanks

-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] re:looking for SQL documentation tool[solved]

2009-03-04 Thread mrfroasty
Thanks guys for the input...really appreciated :-)

-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] re:FOREIGN KEY{ERROR:1005/150}

2009-02-11 Thread mrfroasty
Hello,
I have been browsing on mysql manual
http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
with not much of success.I am trying to put 2 foreign keys(from
different external table) on my table, but if I put the 2nd one it
fails.here is my table

CREATE TABLE pack_accomodation (
id int(16) NOT NULL auto_increment,
pack_id int(16) NOT NULL ,
hotel_id int(16) NOT NULL ,
PRIMARY KEY (id),
INDEX (pack_id),
FOREIGN KEY (pack_id) REFERENCES pack(items_no)
ON DELETE CASCADE
ON UPDATE CASCADE,
INDEX (hotel_id),
FOREIGN KEY (hotel_id) REFERENCES hotel(items_no)
)ENGINE=INNODB;


I can get rid of the 2nd foreign key with programming, but I think it
should be possible to have them both...I just I cant figure out why it
fails with this error:
ERROR 1005 (HY000): Can't create table './tabasam/pack_accomodation.frm'
(errno: 150) For description of the error
http://dev.mysql.com/doc/refman/5.0/en/innodb-error-codes.html

Thanks guys, any help would really appreciate it.



-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net



Re: [PHP-DB] re:store html codes in text field (mysql)-SOLVED

2009-01-08 Thread mrfroasty
Chris wrote:
 mrfroasty wrote:
 Sorry if this has been asked before but I cant seem to find anything
 useful via google..
 I have a text fields which stores my textarea input from a user, my
 design is meant to allow user to submit html codes...but mysql seem to
 replace all html tags with something else...

 Example:
 $title=some text;
 $html_code=h1heading 1/h1

 INSERT INTO $db_table VALUES(null,'$title','$html_code');

 Result in my dB:
 1]some text
 2]lt;h1gt;heading lt;h1gt;

 How can I solve this problem of mysql replacing the html tags.?This
 is probably something familiar to webdev, but I am kind of a noob in web
 programming...

 mysql is 100% not doing it. If you did that manually in mysql, you
 would get the right results.

 mysql create table test (html text);
 Query OK, 0 rows affected (0.01 sec)

 mysql insert into test(html) values ('h1heading 1/h1');
 Query OK, 1 row affected (0.00 sec)

 mysql select * from test;
 ++
 | html   |
 ++
 | h1heading 1/h1 |
 ++
 1 row in set (0.00 sec)

 You have a htmlspecialchars or htmlentities call between $html_code
 being set and where you're doing the insert.

 N:B
 The only way I can think of is replacing them after pulling them out of
 the dB, but I am not sure if this is the way to go...

 See http://au.php.net/manual/en/function.html-entity-decode.php

Thanks for the repliesI did have htmlentities in one of my methods,
so html-entity-decode did the job...fixed now... :-)

-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] re:store html codes in text field (mysql)

2009-01-07 Thread mrfroasty
Sorry if this has been asked before but I cant seem to find anything
useful via google..
I have a text fields which stores my textarea input from a user, my
design is meant to allow user to submit html codes...but mysql seem to
replace all html tags with something else...

Example:
$title=some text;
$html_code=h1heading 1/h1

INSERT INTO $db_table VALUES(null,'$title','$html_code');

Result in my dB:
1]some text
2]lt;h1gt;heading lt;h1gt;

How can I solve this problem of mysql replacing the html tags.?This
is probably something familiar to webdev, but I am kind of a noob in web
programming...

Thanks alot for your time...
muhsin


N:B
The only way I can think of is replacing them after pulling them out of
the dB, but I am not sure if this is the way to go...



-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net



[PHP-DB] re:database tables relations advice

2008-11-27 Thread mrfroasty
I am quite new to database designs, I have a problem in my design...I
can actually feel it, but I am not quite sure if there is a feature in
mysql or I have to solve it with programming.

Example:
CREATE TABLE A (
user_id int(16) NOT NULL auto_increment,
..other datas
PRIMARY KEY (user_id)
   );

CREATE TABLE B (
user_id int(16) NOT NULL auto_increment,
..other datas
PRIMARY KEY (contact_id)
);

Question:
How can I declare that the user_id in my 1st table is related to user_id
in the 2nd table...actually I prefer to have it exactly the same user_id
in both tablesI think if those 2 entries are the same it will be
great, but I am not sure how to achieve this.

P:S
-Ofcourse I know that I can extract it from TABLE A and save it in TABLE
Bbut is that a way to go???Because this issue arise in couple of
tables in my data structure that I am tending to use in my application(web).
-I also know that its possible to  make just 1 big table with lots of
columnsbut I read its not a good database design...

-please advice, running out of ideas :-(

Thanks..


-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] re:database tables relations advice

2008-11-27 Thread mrfroasty
maruti wrote:
 hey lemme knoe, how many columns are you planning for?
 y not put table B columns in table A??
 if you are least bothered about data normalizations, simply go the way
 you want to.
 userId  Name Age Age  Sex Occupation Location
 all the data which has correspondence with userid can be put in a
 single table..
 the case is if you dont've many related tables..
 pavan puligandla
 Microsoft has no beef with OpenSource.


 2008/11/27 mrfroasty [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

 maruti wrote:
  hii,,
  who said table with more no:of columns is a bad database design?
  coming to your tables,
  what do you wanna do??
  if you want to pull out the data of 'X' userid from table B,
 then you
  can use left join.
  make sure that user ID of table A and userID of table B have same
  data. to use joins, atleast one column(s) should be the same in both
  tables.
  let me know whether userID of table B is a foreign key of UserID of
  table A or not?
 
  normalization in all cases doesnt work.
  i'm using spreadsheet as my front end, so my tables are not even in
  the second normal form..
 
  here are some excellent tutorials for joins;
  http://www.tutorialspoint.com/mysql/mysql-using-joins.htm
 
 http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html
  hope these might help u alot..
 
 
  pavan puligandla
  Microsoft has no beef with OpenSource.
 
 
  2008/11/27 mrfroasty [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
 
  I am quite new to database designs, I have a problem in my
 design...I
  can actually feel it, but I am not quite sure if there is a
 feature in
  mysql or I have to solve it with programming.
 
  Example:
  CREATE TABLE A (
 user_id int(16) NOT NULL auto_increment,
 ..other datas
 PRIMARY KEY (user_id)
);
 
  CREATE TABLE B (
 user_id int(16) NOT NULL auto_increment,
 ..other datas
 PRIMARY KEY (contact_id)
 );
 
  Question:
  How can I declare that the user_id in my 1st table is related to
  user_id
  in the 2nd table...actually I prefer to have it exactly the same
  user_id
  in both tablesI think if those 2 entries are the same it
 will be
  great, but I am not sure how to achieve this.
 
  P:S
  -Ofcourse I know that I can extract it from TABLE A and save
 it in
  TABLE
  Bbut is that a way to go???Because this issue arise in
 couple of
  tables in my data structure that I am tending to use in my
  application(web).
  -I also know that its possible to  make just 1 big table
 with lots of
  columnsbut I read its not a good database design...
 
  -please advice, running out of ideas :-(
 
  Thanks..
 
 
  --
  Extra details:
  OSS:Gentoo Linux-2.6.25-r8
  profile:x86
  Hardware:msi geforce 8600GT asus p5k-se
  location:/home/muhsin
  language(s):C/C++,VB,VHDL,bash
  Typo:40WPM
  url:http://mambo-tech.net
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 Quote:
 make sure that user ID of table A and userID of table B have same
 data.

 #That is actually what I am looking for, but I dunno how to achieve
 that.If I can have those 2 user_id columns with the same data, my
 problem is technically solved.But as I said earlier I am limited to
 database skills, its my first application that involves mysql 
 phpdo I need those foreign key stuffs, to have those 2 columns
 with
 the same data??

 --
 Extra details:
 OSS:Gentoo Linux-2.6.25-r8
 profile:x86
 Hardware:msi geforce 8600GT asus p5k-sehave
 location:/home/muhsin
 language(s):C/C++,VB,VHDL,bash
 Typo:40WPM
 url:http://mambo-tech.net



That issue arise like 3 times in my data structurehaving all related
data in one table I might ended up with a table of ~20 columns, it will
be too much and probably bad programming practise.I will have a look
over the net about FOREIGN KEYdidnt know what it is, may be its the
solution...

Thanks for the input



-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit

Re: [PHP-DB] re:database tables relations advice {solved}

2008-11-27 Thread mrfroasty
danaketh wrote:
 This is solved by using FOREIGN KEY but I'm not sure if MySQL have
 them present or just planned for some future release.

 mrfroasty napsal(a):
 I am quite new to database designs, I have a problem in my design...I
 can actually feel it, but I am not quite sure if there is a feature in
 mysql or I have to solve it with programming.

 Example:
 CREATE TABLE A (
 user_id int(16) NOT NULL auto_increment,
 ..other datas
 PRIMARY KEY (user_id)
);

 CREATE TABLE B (
 user_id int(16) NOT NULL auto_increment,
 ..other datas
 PRIMARY KEY (contact_id)
 );

 Question:
 How can I declare that the user_id in my 1st table is related to user_id
 in the 2nd table...actually I prefer to have it exactly the same user_id
 in both tablesI think if those 2 entries are the same it will be
 great, but I am not sure how to achieve this.

 P:S
 -Ofcourse I know that I can extract it from TABLE A and save it in TABLE
 Bbut is that a way to go???Because this issue arise in couple of
 tables in my data structure that I am tending to use in my application(web).
 -I also know that its possible to  make just 1 big table with lots of
 columnsbut I read its not a good database design...

 -please advice, running out of ideas :-(

 Thanks..


   

 -- 

 S pozdravem

 Daniel Tlach
 Freelance webdeveloper

 Email: [EMAIL PROTECTED]
 ICQ: 160914875
 MSN: [EMAIL PROTECTED]
 Jabber: [EMAIL PROTECTED]

Thanks for the input...after some small research I came across this link
http://articles.techrepublic.com.com/5100-10878_11-6035435.html
after that I changed my database to something similar to :

CREATE TABLE user_profile (
 user_id int(16) NOT NULL auto_increment,
   other datas
PRIMARY KEY (user_id)
   )ENGINE=INNODB;

CREATE TABLE user_contact (
user_id int(16) NOT NULL auto_increment,
..other datas
INDEX (user_id),
FOREIGN KEY (user_id) REFERENCES user_profile (user_id),
PRIMARY KEY (user_id)
) ENGINE=INNODB;

That I think problem solved for now...thanks alot :-)

-- 
Extra details:
OSS:Gentoo Linux-2.6.25-r8
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash
Typo:40WPM
url:http://mambo-tech.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php