mikosiko
Members-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
Everything posted by mikosiko
-
in this method.. check the included comment function insert_Observation() { //$Date_Now = datetime(); $esc_HEIGHT = mysql_real_escape_string($HEIGHT, $this->conn); $esc_WIDTH = mysql_real_escape_string($WIDTH, $this->conn); // echo which values you have in $esc_HEIGHT and $esc_WIDTH... they could be null $sql = "INSERT INTO Observations (DATE_TIME, HEIGHT, WIDTH) VALUES (NOW(), '{$esc_HEIGHT}','{$esc_WIDTH}' )"; // As a debugging measure will be good too echo your $sql query and check for problems $result = mysql_query($sql, $this->conn); if (!$result) { die("SQL Insertion error: " . mysql_error()); } else { //$numofrows = mysql_affected_rows($this->conn); return mysql_insert_id($this->conn); } }
-
not enough information... do you get an error?... which one?.. what have you done to debug your code? we don't know anything regarding what your class Number_Information does you said your last sentence is not clear... you mean that you have separated inserts for NUMBER_OF_OBSERVATIONS and the one that you shown in your function insert_Observation() ? be more specific and sure you will get help
-
and what about <a href="<?php echo (defined('S2MEMBER_CURRENT_USER_LOGIN') ? S2MEMBER_CURRENT_USER_LOGIN : post_name);?>/">Client Area</a>
-
in your website... if you move your cursor to whatever point that link to your home page, how that link looks like exactly... maybe something like "www.yourwebsitehere/index.php" ??
-
maybe just because your 'home' could be incorrectly defined... so <a href="home/"> need to be reviewed for existence
-
try <a href="<?php echo (defined('S2MEMBER_CURRENT_USER_LOGIN') ? S2MEMBER_CURRENT_USER_LOGIN : 'home');?>/">Client Area</a>
-
just for curiosity... how much time are you investing in doing all of that?.... how much is the cost of your time?... asking just because a lifetime license of the product that you mentioned cost only around $80 ... your time/efforts worth less than that? ... I probably could understand your effort if they are for your own learning experience... otherwise... well... you got the idea.
-
something like this should work DELIMITER $$ CREATE TRIGGER test_trigg BEFORE INSERT ON table1 FOR EACH ROW BEGIN SET @nc = (SELECT MAX(col1) + 1 FROM table1); IF (ISNULL(@nc)) THEN SET @nc = 1; END IF; SET NEW.col1 = @nc; END $$ DELIMITER ;
-
do you have any reason to make SELECT's and then UPDATE's ?... do you know that you can make the calculations directly in the UPDATE?... therefore all your code could be replaced with just 1 UPDATE
-
I don't follow.... why are you doing a PK with the 6 columns?.... id_member seems to be the candidate field to be the PK (an AUTO_INCREMENT field), and if the remaining 5 fields need to be UNIQUE all together... well... use an UNIQUE constraint covering those 5.
-
First... you should be using explicit JOIN's instead of that implicit notation ... answering your question... you can try this: .... AND indicator.indtypeid = IF( ($indtypeid='*'), indicator.indtypeid, $indtypeid); IF(<condition>, <value if true>, <value if false>)
-
Inserting multiple values into the same mysql column
mikosiko replied to ebotelho's topic in PHP Coding Help
not really... if you read the OP objectives again... specially this sentence therefore... the user is picking all the player that will possibly play... confirmation is post this process, and will involve only those users assigned to that "jogo" NO all the users in the table users as you imply... those users that are finally NOT confirmed can be simply removed of the bridge table... simple.. not need to deal with more tables. but again.. is just mho... your millage can be different. -
Inserting multiple values into the same mysql column
mikosiko replied to ebotelho's topic in PHP Coding Help
or drop completely the nconf_players table and just add a boolean status column (1=confimated, 0=non-conf) to the bridge table (conf_players... even when I will rename it as "jogos_players" most likely to represent the relationship more clearly.). the queries will more easy in that way... jmho -
debugging 101: $describeQuery = "SELECT (Cars.Price * SUM(MonthlySales.TotalSales)) as revenue FROM Car INNER JOIN MonthlySales ON(Cars.CarCode = MonthlySales.ProductCode)GROUP BY Cars.CarCode"; // TEMPORARILY ECHO YOUR RAW QUERY AND TAKE A CLOSE LOOK TO SEE IF IT IS SYNTACTICALLY CORRECT (.. missing spaces, bad sentences, missing values, etc..etc) echo "My Query IS : " . $describeQuery . "<br />"; // IF PREVIOUS ECHO LOOKS OK... EXECUTE THE QUERY $query = sqlsrv_query( $link, $describeQuery); // AND CONTROL IF THE QUERY WAS EXECUTED WITHOUT ERRORS, OTHERWISE DISPLAY THE ERROR if (!$query) { die("QUERY ERROR: " . sqlsrv_errors()); } .... REST OF YOUR CODE
-
PHP not displaying MYSQL result - so strange?? Please help
mikosiko replied to lewisdow123's topic in PHP Coding Help
in your previous post you said: and in your last query you shown so which one is correct?... -
and the error is?.... crystal ball is not available today. to short this out a bit... here .... just copy/paste..... and answer/fix the commented questions <?php error_reporting(E_ALL); ini_set("display_errors", 1); session_start(); $dbhost = "localhost"; $dbname = "webspace_eriknel1"; $dbuser = "webspace_er5"; $dbpass = ""; mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); // you MUST sanitize your input $username = $_POST['username']; $password = md5($_POST['password']); $query = "select * from users where username='$username' and password='$password'"; $result = mysql_query($query); if (mysql_num_rows($result) != 1) { $error = "Bad Login"; // What are yuu trying to do here... redirect to the user to the login page? // For that you must use header() not include() include "login.html"; } else { $_SESSION['username'] = "$username"; // What are yuu trying to do here... redirect to the user to the members page? // For that you must use header() not include() include "memberspage.php"; } ?>
-
@OP: Seems that you are using several smart-quotes and apostrophes instead of regular double or single quotes in your code $username = $_POST[‘username’]; $password = md5($_POST[‘password’]); $query = "select * from users where username=’$username’ and password=’$password’”; $result = mysql_query($query); if (mysql_num_rows($result) != 1) { $error = “Bad Login”; include “login.html”; } else { $_SESSION[‘username’] = “$username”; include “memberspage.php”;
-
drop the LIKE and anything related to it... just format your datetime field date() ; date_format().... you pick http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date
-
the evident error in your code is that you are trying to execute the query before select the db, therefore your query should be failing... change the position of those 2 lines and check
-
Congrats scootstah
-
LEFT JOIN is better