-
Posts
2,134 -
Joined
-
Last visited
-
Days Won
42
Everything posted by benanamen
-
Your connecting to the wrong database. replace mysql with YOUR database name $db = new PDO("mysql:host=$hostname;dbname=mysql", $username, $password);
-
It means the user/password you are connecting to the DB with does not have permission to access. Possible wrong username and/or password.
-
Whatever your trying to accomplish, your doing it wrong. Something like $temp_errors = array(); if (empty(cust_add1)) { $temp_errors[] ='Address Required'; } Then if (count($tmp_errors)) { echo "<div class='error'>"; foreach($tmp_errors AS $error) { echo "$error<br>"; } echo '</div>'; }
-
3. A lot of it is simply using the right tool for the job which means understanding the strengths and weaknesses of each language. You can pound nails with screw driver but a hammer is the best tool for the job.
-
The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE column_name IN (value1,value2,...); ExampleSELECT * FROM Customers WHERE City IN ('Paris','London');
-
I will leave the logic part to someone else to answer. But for my contribution... Your code is vulnerable to SQL Injection. You NEVER EVER send user supplied data directly to the database. You are also using deprecated code that will not work at all in the latest version of Php. You need to use PDO with prepared statements.
-
You have several issues. First, you are using deprecated code. You need to use PDO with prepared statements. Next, you are setting post variables outside of your isset post check so you have errors there. If you turned on error reporting you would see that as well as any other errors You are also mixing mysql with mysqli. You cant do that. Your code is also vulnerable to SQL Injection. You NEVER EVER send user supplied data directly to the database. You need to rewrite the whole thing. None of your code is any good.
-
I have to agree with @Jaques1. This: "I'm not a jquery person myself" pretty much disqualifies you to say this: "buggy and unreliable" Jquery is VERY stable.
-
MySQL Workbench ENUM() Given data type contains error
benanamen replied to ronc0011's topic in MySQL Help
So that's what you call correct expert advice huh? Your gonna go far as programmer. Since, as you said, the enum is for a dropdown, you are already showing yet another flaw in that you are going to store the actual make names as repeated data in some table as the dropdown choice, yet another wrong programming move, but I know, you just don't care about doing anything right. -
MySQL Workbench ENUM() Given data type contains error
benanamen replied to ronc0011's topic in MySQL Help
@ronc0011, All of what you just said makes absolutely NO DIFFERENCE about using enum. You seem plenty determined to do things wrong so why ask for experts help? It already has but you refuse to accept it. Apparently the company has no idea you don't know what your doing and are not willing to listen to people that know much, much more than you. I sure wouldn't want MY fleet maintained with what you are doing. -
For starters, your if(post) and if(submit) is the same exact thing but you have separated them as though they are separate actions. Your $year !="2015" is outside of both of those, so it is undefined. Why do you have $services array? It does absolutely nothing in the code you posted. You also have a random opening label tag. And then, you create all those extra post variables but use the actual POST for the insert which wont work anyways as you have it written. You are also vulnerable to SQL Injection. You NEVER EVER send user supplied data directly to the database. You are also using deprecated code. You need to use PDO with prepared statements. The whole thing is pretty much junk and needs to be re-written from the ground up.
-
MySQL Workbench ENUM() Given data type contains error
benanamen replied to ronc0011's topic in MySQL Help
Using Barands example, you would actually do the same thing for colors. Colors would be in a separate table in the same exact way. -
This is a quickie to get you going. <?php $hostdb = 'localhost'; $dbname = 'phphelp_fixtures'; $username = 'root'; $password = ''; $table = 'fixtures'; $pdo = new PDO("mysql:host=localhost;dbname=$dbname", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM $table"; $stmt = $pdo->prepare($sql); $stmt->execute(); $result = $stmt->fetchAll(); ?> <form class="form-horizontal" role="form" action="<?= $_SERVER['SCRIPT_NAME'] ?>" method="post"> <div class="form-group"> <label class="col-md-4 control-label" for="id">Select</label> <div class="col-md-4"> <select id="id" name="id" class="form-control"> <?php foreach ($result as $row) :?> <option value="<?= $row['id']; ?>"><?= $row['hometeam']; ?></option> <?php endforeach; ?> </select> </div> </div> <div class="form-group"> <div class="col-md-offset-4 col-md-4"> <button id="submit" name="submit" class="btn btn-primary">Submit</button> </div> </div> </form> <?php if (isset($_POST['id'])) { $sql = "SELECT * FROM $table WHERE id=?"; $stmt = $pdo->prepare($sql); $stmt->execute(array($_POST['id'])); $result = $stmt->fetchAll(); foreach ($result as $row) { echo "{$row['hometeam']} {$row['awayteam']}"; } } ?>
-
If you did actually update the ini file you ALSO need to restart apache for it to take effect. You are still missing the closing tags.
-
You are missing two closing PHP tags
-
Stop creating new threads on the same code/subject. You now have THREE threads going on this.
-
MySQL Workbench ENUM() Given data type contains error
benanamen replied to ronc0011's topic in MySQL Help
So you want someone to help you do it wrong? And now that you know it is wrong you still want to do it anyways? Let us know when you want to do it correctly and we will be glad to help. It seems your determined to do it wrong. -
If you use the curly syntax you wont have to do all that variable escaping and concatenation and you will avoid the problem beginners usually have especially if your editor does not have syntax highlighting. echo "<td width=\"100\"><div align=\"center\"><a href=\"Part_Color.php?PartID={$row['PartID']}&Color_ID={$row['ColorID']}\" style=\"text-decoration:none;><br>{$row['PartID']}<br>";?>
-
MySQL Workbench ENUM() Given data type contains error
benanamen replied to ronc0011's topic in MySQL Help
Who told you to do that? Dont do it unless you want to do it wrong. The manufacturers needs to be another table. -
Your DB structure is messed up. Why are you duplicating the empDB table?
-
You need to re-read what was already told to you.
-
Third, you are using deprecated MySql Code. You need to use PDO with prepared statements.
-
Your Json is not valid. $json='{ "glossary":{ "title":"example glossary", "GlossDiv":{ "title":"S", "GlossList":{ "GlossEntry":{ "ID":"SGML", "SortAs":"SGML", "GlossTerm":"Standard Generalized Markup Language", "Acronym":"SGML", "Abbrev":"ISO 8879:1986", "GlossDef":{ "para":"A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso":[ "GML", "XML" ] }, "GlossSee":"markup" } } } } }'; $array = json_decode($json, TRUE); print_r($array);
-
From the manual - mkdir http://php.net/manual/en/function.mkdir.php The mode is 0777 by default, which means the widest possible access. For more information on modes, read the details on the chmod() page. Most likely Php is running as user nobody, not who you think it is.