MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides  
Homepage Register FAQ Members Mark Forums Read Advertise Marketplace FPSowned


Go Back   MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides > Programming > Server side > PHP
Reload this Page [Help]Php mysql coding not working
PHP Discussions about PHP

Reply
 
LinkBack Thread Tools
[Help]Php mysql coding not working
(#1)
Old
Troys's Avatar
Troys is Online
Knight-Captain
Rep Power: 3
Reputation: 76
Troys will become famous soon enough
 
Posts: 409
Join Date: Oct 2006
Location: Palmdale,CA
[Help]Php mysql coding not working - 07-23-2008

Hello all thanks for reading hopefully this problem can be fixed i made this php mysql script for account registration and for some reason its not working
it keeps saying
"Fatal error: Call to undefined function mysql_connect() in C:\Pedregon's 2.4.3 Repack\Server2\htdocs\Insert.php on line 2"

Here is the code

Code:
<?php
$con = mysql_connect("localhost","root","lichking") or Die ('Could not connect: ' . mysql_error());
if ($con)

mysql_select_db("logon", $con);

$sql="INSERT INTO accounts (login,password,gm,email,flags)
VALUES
('login','password','0','email','8')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

($announce = "Account Creation Successfull!");

mysql_close($con);

?>
If some1 can point out what i did wrong and gave me a solution to my problem that would be great !!


Reply With Quote

Donate to remove ads.
(#2)
Old
Tanax's Avatar
Tanax is Offline
Knight
Rep Power: 2
Reputation: 51
Tanax will become famous soon enough
 
Posts: 218
Join Date: Jan 2007
Location: Sweden
07-24-2008

Your error says that the function isn't defined.

Meaning:

1. You've made a little error, such as for example forgetting a ' or a ;
2. Your PHP server doesn't support mysql
3. You don't have a PHP server on your webhotel/localhost


Reply With Quote
(#3)
Old
Troys's Avatar
Troys is Online
Knight-Captain
Rep Power: 3
Reputation: 76
Troys will become famous soon enough
 
Posts: 409
Join Date: Oct 2006
Location: Palmdale,CA
07-24-2008

yea it says the Mysql_connect wont work but yet all sites i go to says thats how you imput it to connect to mysql db


Reply With Quote
(#4)
Old
dejavu11 is Offline
Contributor
Rep Power: 2
Reputation: 86
dejavu11 will become famous soon enough
 
Posts: 263
Join Date: Apr 2007
07-24-2008

Quote:
Originally Posted by Troys View Post
yea it says the Mysql_connect wont work but yet all sites i go to says thats how you imput it to connect to mysql db
PHP doesn't come with built in MySQL support. Odds are you don't have MySQL enabled in your php.ini. Google the error: "Call to undefined function mysql_connect" and you'll find all sorts of pages on how to fix it.
Reply With Quote
(#5)
Old
Tanax's Avatar
Tanax is Offline
Knight
Rep Power: 2
Reputation: 51
Tanax will become famous soon enough
 
Posts: 218
Join Date: Jan 2007
Location: Sweden
07-24-2008

Quote:
Originally Posted by Troys View Post
yea it says the Mysql_connect wont work but yet all sites i go to says thats how you imput it to connect to mysql db
Yes, mysql_connect is indeed the php function used to connect to a mysql database.

Your script probably AINT wrong. But the server is just not supporting it.

Try this server, it's free, and is probably one of the best I've found yet(that is free that is). And guess what? It supports databases

[Only registered and activated users can see links. ]


Reply With Quote
(#6)
Old
Troys's Avatar
Troys is Online
Knight-Captain
Rep Power: 3
Reputation: 76
Troys will become famous soon enough
 
Posts: 409
Join Date: Oct 2006
Location: Palmdale,CA
07-24-2008

Thanks for the link and for the help i appreciate it !

Quote:
Originally Posted by dejavu11 View Post
PHP doesn't come with built in MySQL support. Odds are you don't have MySQL enabled in your php.ini. Google the error: "Call to undefined function mysql_connect" and you'll find all sorts of pages on how to fix it.
Its enabled and it works fine with other scrips that connect



Last edited by Troys; 07-24-2008 at 09:28 PM..
Reply With Quote
(#7)
Old
insanesk8123's Avatar
insanesk8123 is Offline
Contributor
Rep Power: 3
Reputation: 257
insanesk8123 is a jewel in the roughinsanesk8123 is a jewel in the roughinsanesk8123 is a jewel in the rough
 
Posts: 585
Join Date: Feb 2007
Location: main(String[] args)
07-25-2008

try putting an @ in front of it like this:
$con = @mysql_connect("localhost","root","lichking")


By Jerbab
Reply With Quote
(#8)
Old
dejavu11 is Offline
Contributor
Rep Power: 2
Reputation: 86
dejavu11 will become famous soon enough
 
Posts: 263
Join Date: Apr 2007
07-25-2008

Quote:
Originally Posted by insanesk8123 View Post
try putting an @ in front of it like this:
= @mysql_connect("localhost","root","lichking")
That will supress the error from being shown but it's not going to fix the problem.
Reply With Quote
(#9)
Old
Troys's Avatar
Troys is Online
Knight-Captain
Rep Power: 3
Reputation: 76
Troys will become famous soon enough
 
Posts: 409
Join Date: Oct 2006
Location: Palmdale,CA
07-25-2008

Quote:
Originally Posted by insanesk8123 View Post
try putting an @ in front of it like this:
= @mysql_connect("localhost","root","lichking")
Hey insane long time no see =]

and as for the code still not working i have edited it so many times to fix it im trying the hosting company see if that will fix it.
Here is all the code im using for the account creation table .

This is what im trying to make

And the code for this is

Code:
 

<form id="contactForm" name="form2" method="post" action="insert.php">
    

<h2>Account Register</h2><br class="spacer" />
      <label>Username:</label>
      <br class="spacer" />
        <input type="text" name="textfield2" />
        <label>Password:</label><br class="spacer" />
        <input type="text" name="textfield2" />
        <label>Re-type Password:</label>
        <br class="spacer" />
        <input type="text" name="textfield2" />
        <label>Email :</label><br class="spacer" />
            <input type="text" name="textfield2" />
         
      <input type="image" class="submit" src="images/submit_bg.gif" title="submit" />   
   </form>


Reply With Quote
(#10)
Old
dejavu11 is Offline
Contributor
Rep Power: 2
Reputation: 86
dejavu11 will become famous soon enough
 
Posts: 263
Join Date: Apr 2007
07-25-2008

Quote:
Originally Posted by Troys View Post
Thanks for the link and for the help i appreciate it !



Its enabled and it works fine with other scrips that connect
You mentioned that you were going to contact "the host" but everything seems to say you are hosting this locally.

Quote:
= mysql_connect("localhost","root","lichking")
I don't know of any hosts that would give you MySQL root access

Quote:
C:Pedregon's 2.4.3 RepackServer2htdocsInsert.php
Odds are they also wouldn't be having an emulation server running on their webserver.
Reply With Quote
(#11)
Old
Troys's Avatar
Troys is Online
Knight-Captain
Rep Power: 3
Reputation: 76
Troys will become famous soon enough
 
Posts: 409
Join Date: Oct 2006
Location: Palmdale,CA
07-25-2008

I fixed that all its being hosted on a free server im trying to see if it works finally /cross fingers


Reply With Quote
(#12)
Old
dejavu11 is Offline
Contributor
Rep Power: 2
Reputation: 86
dejavu11 will become famous soon enough
 
Posts: 263
Join Date: Apr 2007
07-25-2008

Quote:
Originally Posted by Troys View Post
I fixed that all its being hosted on a free server im trying to see if it works finally /cross fingers
What was the problem in the end?
Reply With Quote
(#13)
Old
Troys's Avatar
Troys is Online
Knight-Captain
Rep Power: 3
Reputation: 76
Troys will become famous soon enough
 
Posts: 409
Join Date: Oct 2006
Location: Palmdale,CA
07-25-2008

well now after i click submit its saying 404 error >.<
i dont know if its trying to go to insert.php or what all insert is is the php code for the registration its not supposed to be a page =/

ugh this is the hardest most fustrating code i have ever done ..and also dejavu thanks a ton for helping me


Reply With Quote
(#14)
Old
dejavu11 is Offline
Contributor
Rep Power: 2
Reputation: 86
dejavu11 will become famous soon enough
 
Posts: 263
Join Date: Apr 2007
07-25-2008

Hey I'm just happy to see action in the PHP section. 404 = page not found. If you're using the code you have above it is trying to go to insert.php.

Quote:
<form id="contactForm" name="form2" method="post" action="insert.php">
Do you have an insert.php in the same directory?
Reply With Quote
(#15)
Old
Troys's Avatar
Troys is Online
Knight-Captain
Rep Power: 3
Reputation: 76
Troys will become famous soon enough
 
Posts: 409
Join Date: Oct 2006
Location: Palmdale,CA
07-25-2008

yep its all hosted in 1 place


Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361