Jul 25, 2008

Different Styles Of Mysql Coding.

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Different Styles Of Mysql Coding.

O2xygen
I look around the place, and at my own MYSQl scripts, and most look the same except with a few differing factors.

Now Im relativly new to MYSQL, and not so new to PHP. The problem is though, I havent been able to test my scripts/site out so Im not sure if my scripts are right.

For example, heres a script to create my user table.

CODE
<?php

$DBhost = "localhost";
$DBuser = "********";
$DBpass = "*********";  
$DBName = "*********";

$connection = @mysql_connect($DBhost,$DBuser,$DBpass);
echo "SQL Connection";


mysql_select_db("$DBName") or die("Unable to select database $DBName" . mysql_error() );


?>
<?php



$sql = "create table users('
'ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, ' .
'dob_day TINYINTUNSIGNED,'.
'dob_month TINYINTUNSIGNED,'.
'dob_year TINYINTUNSIGNED,'.
'quote text,'.
'namefirst char(20),'.
'namelast char(20),'.
'email char(255),'.
'username char(255),'.
'minitar char(255),'.
'password char(255),'.)";

mysql_query($sql)

$result = mysql_query($sql) or die("Login Query Failed." . mysql_error() . " ". $sql);

?><html><head><title>Table created</title></head>

<body><p>DONE!</p></body>

</html>


and when I compare this to others, some things differ, like the 'ID INT UNSIGNED' bit has underscores instead of spaces and is in lower case.

So my question is, does these differing factors matter?

Oh, by the way, Im new so Hi everyone biggrin.gif

 

 

 


Reply

FaLgoR
You missed the ; here:

QUOTE
...
'username char(255),'.
'minitar char(255),'.
'password char(255),'.)";

mysql_query($sql)

$result = mysql_query($sql) or die("Login Query Failed." . mysql_error() . " ". $sql);
...

Reply

bjrn
QUOTE(O2xygen @ Apr 12 2005, 07:39 AM)
I look around the place, and at my own MYSQl scripts, and most look the same except with a few differing factors.
<snip>

and when I compare this to others, some things differ, like the 'ID INT UNSIGNED' bit has underscores instead of spaces and is in lower case.

So my question is, does these differing factors matter?

Oh, by the way, Im new so Hi everyone biggrin.gif
*



I know that in some database systems upper/lowercase is important (like Oracle), but I don't think uppercase/lowercase is important in MySQL. However, I would think that there is a big difference between "ID INT UNSIGNED" and "ID_INT_UNSIGNED", the second one would just be one huge field name, and probably give off a syntax error because you didn't specify a type.

So, upper/lowercase probably doesn't matter (in MySQL), but don't exchange underscores for spaces.

And Hi. Welcome to Trap17. smile.gif

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : styles, mysql, coding

  1. How Do I Find My Mysql Password? [resolved]
    Cannot access my MySQL (5)
  2. Please Explain Me Mysql
    How do i insert information into this config: (4)
    Hi, I wanted to try just to test how can i connect my website to another mysql server, but i have no
    idea how to insert the other mysql information such as port and host etc.... so here is the config
    file please give me an example CODE <?php // mySQL information $server =
    'FRESHSQL.COM:3306';                   // MySql server $username =
    'vasilevich';                      // MySql Username $password =
    '*******';                         // MySql Password $database =
    'vasilevich';                  // MySql Da....
  3. Remote Access Mysql
    (8)
    Is it possible to directly access my local database from my website? For example, if somebody
    submits info on my website, the info they submitted would be transferred to my local database
    directly. Is that possible? And if so, how do I set that up? The reason I don't want to upload
    my database to my subdomain is because it would be difficult to keep the website database and my
    local database in sync . . . or is there a way to do that? Thanks for any replies.....
  4. Create Table - Mysql Code - Help
    (1)
    I need your feedback about setting the database issues. Please, review them and correct some entries
    in the code if they got some mistakes. This is the code itself: SQL CREATE TABLE
    `news` ( `id` int(250) NOT NULL auto_increment, `title` varchar(255)
    NOT NULL default '', `text` text NOT NULL, `author` varchar(255) NOT
    NULL default '', `valid` varchar(255) NOT NULL default '',
    `date` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE = ....
  5. Mysql Error
    (3)
    ok i need some more help from the wonderful coders here at Trap. I'm almost done with my CMS
    script, but i'm having a problem with the installer.php file, when it trys to inseret the user
    data into the database i keep getting the following error: CODE mySQL Error: You have an
    error in your SQL syntax; check the manual that corresponds to your MySQL server version for the
    right syntax to use near ';INSERT INTO `members` (`id`, `name`,
    `username`, `password`, `email`, `title`) ' at lin....
  6. Coding A Web Design
    Need (a lot) of help with coding my web design (14)
    I have been here for some months and I have always wanted to get my page up and going. I have tried
    to learn HTML, but it was too hard. Getting my web design coded is the only thing that keeps me from
    actually being able to create the rest of my website. I know that many people find it fun to create
    a website, and yes; I do to. But coding it is something out of my reach. Therefore I am asking you
    for help. I am really hoping that there is some kind souls out there willing to use their time on a
    little lost bear. If anyone with the right skills are willing to help me, I ....
  7. Mysql
    Several files in one field. (2)
    Hi guys. I want t know if it is posible to have so many entries for one object in a field in MySQL.
    I know my question may not be clear because I lack in terminology but pliz try and help. What I want
    to do is for axample have a database of my clients with the following fields for every client:
    fname, lname, more than one photos, contrubutions(comments, jokes, testimonials posted) etc. I want
    to have the things like the photos in the same field but they have to be unique so that my php code
    can deal with them individually llike they are coming from different fields.....
  8. Coding Help!
    Need Tutorial?! (3)
    Hey, guys... How can I build the following things. I already made the simple administrator page
    where I may add some news to the web-site, but I need to make one more things described below.
    Please, help me if you can. This is the way how it has to work. The process is described by two
    things of the illustrations: The first picture (or brief description of the news) will be
    somehow placed on the main page, the main page may have several of those things. On the first
    picture, you may see that is marked by red named : "Full Descr." that I mean full descriptio....
  9. Html Form!
    Using MySQL?! (4)
    Hey, I need your help again! I need some good working tutorial how I can update my SQL through
    HTML form. I did use some tutorials online found with the help of google; but they do not work
    properly; I mean there are still small mistakes. I need to have a good tutorial to follow. It
    should be based on security and more things. It has to be done in proper way.......
  10. The Coding Group
    (22)
    I'm sure by now everybody knows the evil group, and I've been waiting for somebody to make a
    rival group to it and perhaps we could have a group battle. I was going to start one myself but I
    didn't feel it appropriate being in both groups rival to each other so to inspire people to make
    their own "groups" I created a neutral one. The coding group. The members and their tag lines are
    as follows: QUOTE OpaQue (CrYpToLoGiC, MaDScIenTIsT, l33t Programmer) , galexcd
    (Evil Programmer) , truefusion (Analyst Programmer) , ....
  11. Best Php And Mysql Editor For Noobs
    anyone any php or mysql editor that is good for noob (6)
    hi there guys, from my previous posting, i am a noob in php and mysql programming. I want to know
    if there are any php and mysql editors which are best for me as a noob. i appreciate your kindness
    ....
  12. Php And Mysql Programming
    anyone knows a code for mysql and php (2)
    hi everyone! I am making a program using php and mysql...I am a noob on this so i need your
    help guys...I want to make a simple program that will some values and then store them on a database
    and then retrieve them...uhmm let me give an example out put of what i need. This is the example
    say..: Enter First Name: Enter Last Name:
    Enter Age: Enter Address: ..those
    are the data needed for input values...my question now is how can I make a database....
  13. Mysql, Php, Apache Downloads And Setup Was A Nightmare
    Mysql, PHP, Apache (9)
    Mysql, PHP, Apache downloads were easy enough. Then came the setup process. This seemed to be an
    endless mess of going back and forth trying to get the programs to work together properly. Finaly I
    got them working after about 48 hours. There are great tutorials on the setup process, but only one
    or two actualy were easy enough for me to understand. I would like to see if I was the only one who
    had issues with this setup. Are there easier ways to setup the three?....
  14. Mysql-essential-5.0.51 Installion Problem
    please help me.(urgent) (2)
    Dear friend, please help me. Iam working on php project (matchmaking site). I have downloaded mysql
    essensial 5.0.51. When i was installing mysql 5.0.51, i got following error - Error 1901: Error
    attempting to read from the source installation database:
    c:\windows\installer\527ec6.msi What is solution of this problem ? Iam using
    windows xp professional version 2002 (service pack 2). Please post your reply. Iam waiting for your
    answer. ....
  15. Database With Mysql++
    getting mySQL++ to work with trap17 (7)
    Hi, I'm trying to build an online game and figured the easiest way to do the server list would
    be to make a mySQL database for it; however, I use the con() command on the IP i get from pinging my
    website and I always get an abnormal program termination; however, it will work with the mySQL on my
    own machine. The code is below: CODE #include <iostream> #include <iomanip>
    #include <mysql++> #include "pass.h"//holds my password (i program at
    school) int main(void) {     Connection con("t3jem3_test","....
  16. Tools Needed!
    PHP & MySQL (9)
    Hello, everyone! I need some tools for those two things to test PHP scripts coming together with
    database on my laptop, instead checking them on a web-server which takes time.....
  17. Mysql + Php Question
    (5)
    Hi, I am creating a website in php and using a mysql database to store the data. I want to store
    time data in the database. My question is what is the best datatype I should use and how do I read
    the time from the database and format(display) it using php ?....
  18. Mysql Won't Update
    (4)
    Ok, so I'm making some arcade administration software so I don't have to add games the hard
    way, well anyway, one of the features I have is that on the homepage is a featured author and as
    such I just have it so it updates one line in the mySQL. Well, the page with the form passes on the
    varibles fine and the updating page recieves them because I echoed everything, then I build the
    query and I even echo the query and it comes out exactly how I want it to, but for some reason, the
    database itself won't update even though all the varibles are there. Here's....
  19. Colors/styles For Text?
    How do we change colors? (2)
    How do i change colors or styles of text in c++? like for colors eg. : hello world for styles:
    Hello World ....
  20. Paintball: Spray-and-pray Vs. One-shot-one-kill
    A debate on two shooting styles (3)
    As we all know, paintball, from the "pro" standpoint, has become a game of who can release the more
    constant stream of paint as opposed to its roots where players didn't even have hoppers (and if
    that, ones that could only hold 40 paintballs). There are now two ways of play when it comes to
    shooting styles: spray-and-pray, and the actual (and now traditional) way of aiming. Is it
    better to be able to shoot 20+ balls per second at players? From my standpoint, I can see how it
    can be a little scary with a ton of paint flying in your direction. You could lite....
  21. Qupis : Free Hosting With Php, Mysql, Cpanel. (one Line Text Ad At Bottom)
    a member of Xisto (41)
    Hello Members, We are proud to introduce a new member to Xisto group of sites.
    Qupis : Free Web Hosting 150 MB space, 5000 MB Bandwidth, php,
    mysql, CPanel (Latest). Emails, FTP, Addon domains, Parked Domains etc.
    http://www.Qupis.com
    Feel free to add your reviews and comments about it. -Trap17
    Management ....
  22. Is It Possible To Access The Mysql Remotely?
    (10)
    I like to experiment with a lot of things and I was thinking of making a sort of instant messenger
    in Python, but I want to let people have actual accounts so I need to be able to access the mySQL
    remotely. If that's not possible, are we allowed to run Python scripts on the server?....
  23. Check Referrer To Prevent Linking Yours From Other Sites
    Check referrer with Php and Mysql (8)
    Check Referrer Using Php To Prevent People Linking To Your Downloads From Other Sites Ever
    find that found some people are listing items, images and tuts and linking directly to the download
    url (those that are like my photoshop tutorial.php?id=0), which is a .php to count the number of
    downloads. To prevent this, you can add a piece of code to the download pages that checks which page
    referred them to the download page: if it's my domain, it downloads the file normally, if
    it's not, it will redirect to my home page instead. Important : Not all browser....
  24. Sattelite,reseiver(star Sat),coding ....
    (3)
    Hello , in This topic first I tell you about RS 232 cable that you must have to upgrade your
    reciever: Cable RS 232 Secend about Star-sat Reciever i want to tell you: go to Menu>STB
    Status>h/w = ? if = 2.10 its 1 mb if = 3.10 or 3.00 its 2 mb if = 7 its 2 mb Then go to
    http://satdw.com and download your path and loader (EM upgrade) and Dream loader(for softcam) then
    read " Guide To Download" to knopw how to upgrade!! I Will tell sth else if you like!
    please tell your Idea about this /blink.gif" style="vertical-align:middle" emoid=":blink:"
    border="0" a....
  25. Can You Add Images Into A Mysql Database?
    Using Php? (20)
    I'm learning php in class right now, but I'm still not that good at it, what I'm
    wondering is when I write the php so that it can connect with a database, can I at the same time
    have it that it is able to display back images that I choose. Like, I want a search feature, where
    you can search for a keyword, and it will bring back a list of all the possible entries with that
    keyword, but each of these entries will have a photo associated with it. Now, do I put these image
    files directly into the database, or do I write the code to link them from my files to th....
  26. Installing Apache, Mysql, Phpmyadmin Locally
    Solving the "php_mbstring.dll missing" (5)
    Since Trap17's CP provide the individual site's owner with goodies like MySql and
    PhpMyAdmin, chances are some will want to make use of them. Well, it's fine enough to get that
    on one's host (Gee! Thanks a lot, Trap17...) Knowing how the usual geek react, it might be
    expected that most people considering to make use of a database on their site will want to do most
    of the tedious job of developing and testing on their own local system before sending the wrapped-up
    result on their domain/subdomain. This involves four basic steps (sorry for the compuwi....
  27. Mysql Database Size
    related to the free database space (6)
    hi all! this is my first post /biggrin.gif' border='0' style='vertical-align:middle'
    alt='biggrin.gif' /> and i have a doubt, how much mysql space i am allowed to use... i mean how
    much is available for my free account....
  28. Import From Excel File Into Mysql Database
    (7)
    Has anyone tried using the excel import function that comes with phpmyadmin
    http://www.phpmyadmin.net/home_page/ - it does not require any additional plug-ins or scripts and
    is fairly straightforward to use. In phpmyadmin, if you click on the database table which you wish
    to import the data to , there is a link on the bottom left corner which says "insert data from a
    text file into the table" - although it says text file it still can be used to import an excel file.
    When you click on this link you will be taken to a page where you will be asked for the file name
    (the....
  29. Learning Mysql
    pls guide (3)
    hello out there, i have already looked through on this tutorial forum.. and still can find any
    topics which related to MySql basic.. i wanna learn about how to create MySql table and its
    concept!! just basic.. i've no knowledge on MySql before nor any other database server
    software.. but i do have littol konwledge on programming,scripting,html basic in concept.. pls dun
    gave me so many links so as i can be blur for none about how to get start!! /laugh.gif'
    border='0' style='vertical-align:middle' alt='laugh.gif' /> i can thou find from Googles sear....
  30. Complete Login System
    With PHP + MYSQL (56)
    Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
    are tryn to learn PHP. First, let's make register.php: CODE <?
    include("conn.php"); // create a file with all the database connections
    if($do_register){ // if the submit button were clicked if((!$name)
    || (!$email) || (!$age) || (!$login) ||
    (!$password) || (!$password2)){ print "You can't let
    any fields in blank....

    1. Looking for styles, mysql, coding

Searching Video's for styles, mysql, coding
Similar
How Do I
Find My
Mysql
Password?
[resolved] -
Cannot
access my
MySQL
Please
Explain Me
Mysql - How
do i insert
information
into this
config:
Remote
Access Mysql
Create Table
- Mysql Code
- Help
Mysql Error
Coding A Web
Design -
Need (a lot)
of help with
coding my
web design
Mysql -
Several
files in one
field.
Coding
Help! -
Need
Tutorial?
3;
Html
Form! -
Using
MySQL?!
The Coding
Group
Best Php And
Mysql Editor
For Noobs -
anyone any
php or mysql
editor that
is good for
noob
Php And
Mysql
Programming
- anyone
knows a code
for mysql
and php
Mysql, Php,
Apache
Downloads
And Setup
Was A
Nightmare -
Mysql, PHP,
Apache
Mysql-essent
ial-5.0.51
Installion
Problem -
please help
me.(urgent)
Database
With Mysql++
- getting
mySQL++ to
work with
trap17
Tools
Needed!
- PHP &
MySQL
Mysql + Php
Question
Mysql
Won't
Update
Colors/style
s For Text?
- How do we
change
colors?
Paintball:
Spray-and-pr
ay Vs.
One-shot-one
-kill - A
debate on
two shooting
styles
Qupis : Free
Hosting With
Php, Mysql,
Cpanel. (one
Line Text Ad
At Bottom) -
a member of
Xisto
Is It
Possible To
Access The
Mysql
Remotely?
Check
Referrer To
Prevent
Linking
Yours From
Other Sites
- Check
referrer
with Php and
Mysql
Sattelite,re
seiver(star
Sat),coding
....
Can You Add
Images Into
A Mysql
Database? -
Using Php?
Installing
Apache,
Mysql,
Phpmyadmin
Locally -
Solving the
"php_mb
string.dll
missing"
;
Mysql
Database
Size -
related to
the free
database
space
Import From
Excel File
Into Mysql
Database
Learning
Mysql - pls
guide
Complete
Login System
- With PHP +
MYSQL
advertisement



Different Styles Of Mysql Coding.



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE