ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
what does the n then precisly do? does it define the bytes used? 2^n?
-
INTEGER(n) the n in previous code tells the length to integer, 0 <= n <= 255, for example n = 4, am i then only able to create 9999 rows? the mysql.org documentation says it doesn't affect the length at all, meaning that if i write INTEGER(4) i still will be able to create 4 billion rows (unsigned), so what does the n actually do? kind regards, ignace
-
would it be possible you need something like? Men + shirts + sweatshirts + socks + .. Women + shirts + sweatshirts + socks + .. Kids + toy's + < 5 year + > 5 year CREATE TABLE category ( id int(11) NOT NULL auto_increment, parentId int(11) NOT NULL default '0', ... PRIMARY KEY (id) ); for the products problem as many products fit into many categories CREATE TABLE product ( id int(11) NOT NULL auto_increment, .. PRIMARY KEY (id) ); CREATE TABLE product_to_category ( productId int(11) NOT NULL default '0', categoryId int(11) NOT NULL default '0' );
-
How do you provide a unique url that expires or prevent a user from accessing...
ignace replied to j5uh's topic in MySQL Help
wrong forum mate, should have been php and here is the solution to your problem, it's called "generating one-time url's" (that's a hard one ) http://www.onlamp.com/pub/a/php/2002/12/05/one_time_URLs.html -
i have got 3 tables (faq, newsletter & content) should i create one category table for them all, or should i create an individual table for every one of 'em (faqCategory, newsletterCategory & contentCategory) this method however encourages redundant data as a category name may be useable in multipe tables (e.g. general is useable in faq, newsletter & content)? Kind regards, Ignace
-
<?php $content = file_get_contents('template.html'); // html file with {VARIABLES} defined $replacement_parts = array(); while (false != (list($key, $value) = each($replacement_parts))) { $content = str_replace('{' . $key . '}', $value, $content); } echo $content;
-
SELECT count(*) FROM people GROUP BY department
-
dynamic optgroup drop down menu using mysql & php
ignace replied to dm404's topic in PHP Coding Help
SELECT * FROM area INNER JOIN venue ON area.AreaID = venue.AreaID ORDER BY AreaRegion DESC -
Hey, I was wondering what are plugins and what are modules, of what i have read modules are something like an application inside your application? Plugins on the other hand are something like extensions, i think? But how do you create plugins and/or modules and make them work well with your application? Greetz, ignace
-
A) Should be available to you at a local fun store B) Take a look at unit testing http://www.google.com/search?q=unit+testing
-
nothing ever seems hard to do, until you get to do it..
-
it is possible, also if you are willing to pay people to do it for you, then you should have post it in http://www.phpfreaks.com/forums/index.php/board,8.0.html <form action="" method="post" enctype="application/x-www-form-urlencoded"> <table> <tr> <td><label for="username">Username</label>:</td> <td><input type="text" id="username" name="username" /></td> </tr> <tr> <td><label for="password">Password</label>:</td> <td><input type="text" id="password" name="password" /></td> </tr> <tr> <td><label for="comp_name">Competition name</label>:</td> <td><select id="comp_name" name="comp_name"> <option value="comp_one">First competition</option> <option value="comp_two">Second Competition</option> </select></td> </tr> <tr> <td><label for="round">Round</label>:</td> <td><input type="text" id="round" name="round" /></td> </tr> <tr> <td colspan="2"><input type="submit" id="submit" name="submit" /></td> </tr> </table> </form> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!empty($_POST['username']) && !empty($_POST['password'])) { // do something, login or so // get result or something } // if no input results (whatever that may be), then show dropdown and submit button } ?>
-
displaying results from an array stored in database
ignace replied to minxie6's topic in PHP Coding Help
<?php print_r(unserialize($colourstring));?> gives you back the array -
<?php foreach($_SESSION['order'] as $key => $product) { $query = "insert into productorder values ('".$order."','".$_SESSION['order'][$key]['productnumber']."','".$quantity."', 'pending approval','".$_SESSION['order'][$key]['price']."')"; ?> should be <?php for ($i = 0; $i < count($_SESSION['order']); $i++) { $query = "insert into productorder values ('".$order."','".$_SESSION['order'][$i]['productnumber']."','".$quantity."', 'pending approval','".$_SESSION['order'][$i]['price']."')"; } ?>
-
javascript is a client-side language, php a server-side language use instead <?php if (array_key_exists('HTTP_REFERER', $_SERVER)) { header('Location: ' . $_SERVER['HTTP_REFERER']); } else { echo "<a href=\"#\" onclick=\"javascript:history.go(-1);\">click here to go back</a>"; } ?>
-
add <?php if ($result !== null) { ?> before if (mysql_num_rows($result)..
-
or he is referring to LAST_INSERT_ID() which does exist in MySQL
-
normally you would be able to find this on the phpfreaks main page, but since it is offline for maintenance reasons.. <?php // http://be2.php.net/manual/en/features.file-upload.php#features.file-upload.post-method $post_name = 'userfile'; $where_to = ''; // path to upload directory (no trailing slash) if (strcmp(strtolower($_SERVER['REQUEST_METHOD']), 'post') === 0) { if (array_key_exists($post_name, $_FILES)) { $upload = $_FILES[$post_name]; $where_to = implode(DIRECTORY_SEPARATOR, array($where_to, $upload['name'])); if (is_uploaded_file($upload['tmp_name'])) { if (move_uploaded_file($upload['tmp_name'], $where_to)) { printf("<img src=\"%s\" width=\"100\" height=\"100\" />", $where_to); } else { // error } } else { // nothing uploaded } } else { // $post_name not present in $_FILES } } ?>
-
for ($i = 1; $i <= 1; $i++) // $i = 1 and you iterate till $i = 1, so one iteration...
-
obviously a php.ini issue alter the php.ini path for your terminal, and you will most likely get the same output
-
<?php if (strcmp(strtolower($_SERVER['REQUEST_METHOD']), 'post') === 0) { // form submitted if (array_key_exists('add_item', $_POST)) { // user is adding items } else if (array_key_exists('form_submit', $_POST)) { // user is submitting the form } } ?>
-
how do I display current number of registered users on login page
ignace replied to djsting_com's topic in PHP Coding Help
<?php $sql = "SELECT COUNT(*) num_reg_mem FROM users"; $result = mysql_query($sql); if (mysql_num_rows($result) != 0) { list($num_reg_mem) = mysql_fetch_array($result, MYSQL_NUM); echo $num_reg_mem; } ?> -
<?php $to = 'x@gmail.com'; $subject = 'Wakeup bob!'; $message = "yo, whassup? $studentname1 and ticket total $tickets_total"; // must be double quoted to be able to use variables inside a string $headers = "From: x@gmail.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> tested this code, it works for me