a:link, a:visited, a:active { text-decoration: none}
Should be outside of the body{}
block. Move it, that should fix it.
Same goes for .mainrow near the bottom. You can't nest CSS selectors like that.
a:link, a:visited, a:active { text-decoration: none}
Should be outside of the body{}
block. Move it, that should fix it.
Same goes for .mainrow near the bottom. You can't nest CSS selectors like that.
What exactly isn't working in safari/chrome (specifically what part of the CSS isn't working)? The PHP has nothing to do with it I can tell you that.
HAHA, fire the developer, there's your feedback. Stylesheets promote a centralized design(reusability, consistency, etc.) They save time, are (most of the time) completely cross-browser compatible(you'll learn to hate IE6)
Why are you putting your message text directly in the header and leaving the message argument blank? http://php.net/mail
Hello I've a question when creating a class with functions.
e.g.
function constructor() { this.myFunc = function() { return "Hello World"; } }
do I have to write the function in that way? this.funcName = function() for every function in that class?
Because when I tried to write it in this way instead
function constructor() { function() myFunc{ return "Hello World"; } }
It does not work if it is bundled like function in a function. When I create an object of constructor, and then try to call the myFunc function.
In Javascript functions are first class members meaning a function is a type just like an int or a string. Using this.varname = function(){};
is assigning a variable to this.varname, the variable type just happens to be a function. If you use function funcname(){}
it declares it in the current scope and is destroyed once you leave that scope. IE., if you declare it inside another function you can't access it outside that function.
Ok. Is that like this :
$query = "INSERT INTO tcg ClientsName, PrgNo, PrgName VALUES('$ClientsName','$PrgNo','$PrgName')";
??
Did you not read my post on how to do it? Go ahead, its about 4 inches above this post.
How're you going to learn if you have everyone do it for you?
No, the problem is that you aren't specifying the fields you want to insert into (this should be done even if you are doing them in order to save an internal lookup)
INSERT INTO <table> (field1, field2) VALUES ('field1_value', 'field2_value')
What is $today equal to?
I have this attitude because you wont bother to help yourself. Your correct, this is a help forum, not a handholding forum.
Go read up on how SQL works then come and ask the question again, I'm not going to help you until then. There are umpteen tutorials on the net, if you don't understand them its frankly not my problem and this is really simple stuff that you should be able to wrap your head around quite simply.
Well if you want the activation key to be equal to something then put the variable in there like you did with $email
Ahh, I didn't see that. Why do you have parenthesis around it, and why are you mixing saving the query to a variable then querying versus just querying?
AND is used instead of commas in the WHERE clause.
SELECT * FROM userinformation WHERE `email` = '$email' AND `username` = '' AND `activationkey` = ''
$variable[]=$row[0];
Arrays use the []= operator, not +=
No, you're not querying.
$query = ("SELECT * FROM userinformation WHERE `email` = '$email', `username` = ' ', `activationkey` = ' ' ");
should be
$query = mysql_query("SELECT * FROM userinformation WHERE `email` = '$email', `username` = ' ', `activationkey` = ' ' ");
www.w3schools.com/jsref/jsref_obj_regexp.asp Regular expressions were made for this, they'll be hard to grasp at first but they'll be your friend in the end.
I think this is about the third post like this, you aren't actually querying. You have to call mysql_query, right now you just have it wrapped in parenthesis.
$var = $variable.$i;
$$var = $row[0];
I'm not entirely sure why you would want to do this instead of use an array though.
Well when using file_get_contents a request is sent to the remote server with the User Agent as "PHP" which can be configured in php.ini. I believe the same holds true for cURL but a cURL request can be configured to customize the user agent. So yes, it does get logged like a normal request.
Textareas work by having their value as the content between the tags
<textarea cols="60" rows="12" id="query" name="query">
<?php if (isset($_POST["query"])) { echo htmlspecialchars($_POST["query"]); } ?>
</textarea>
if ($_POST['query'] < 15 ) {
echo "<p>You have not entered anything in the text box provided. A minimum of 15 characters is required.</p>";
$err++;
}
That doesn't do what you think it does. It tries to turn the string into a number and compare it.
You want to do this
if (strlen($_POST['query']) < 15 ) {
With the math.h
(or cmath someone correct me on this) header you can use the floor
and ceil
functions if I remember correctly to round down and round up respectively.
A) Post your form
B) if (strlen($_POST['query'] == 0 ) ) {
should be if (strlen($_POST['query']) == 0) {
I usually like to take the time and explain why its wrong but I'm lazy today so I'll just fix it.
<?php
class DBconnection {
private $host="localhost";
private $user="root";
private $password=null;
private $database="classTest";
private $conn;
private $db;
private static $instance = null;
private function __construct() {
$this->conn=mysql_connect($this->host, $this->user, $this->password);
$this->db=mysql_select_db($this->database);
}
public static getInstance()
{
if(self::$instance === null) {
self::$instance = new self;
}
return self::$instance;
}
public function getConnection()
{
return $this->conn;
}
}
// ExecuteSql should NOT extend DBconnection, it just doesn't make any damn sense
class ExecuteSql {
public static function executeSql($sql) {
$db = DBconnection::getInstance();
$runSql=mysql_query($sql, $db->getConnection()) or die ("ERROR: Database connection error");
if (@mysql_num_rows($runSql) == 1) {
return "VALID";
} else {
return "INVALID";
}
}
}
// Once again, why the hell is this extending DBconnection?
class Login {
public function __construct($username, $password) {
// NOOOO!!!!!!!!!!!! DBconnection::__construct();
echo ExecuteSql::executeSql("SELECT id FROM login WHERE username='$username' AND password='$password'");
}
}
If you want an explanation ask, otherwise just continue on not reading documentation like you were before.
Don't know, do echo mysql_error();
in between $getAll= and $rows =
move the echo '</table>';
outside the loop. or just put </table> before </body> and remove the echo altogether
well yeah, the fact that you left out that it said data.Student is pretty big :) lowercase Student on line 32 , case is important, that should fix it
K, last addition, if this doesn't give us something then I'm fresh out of ideas. replace mysql_select_db() with
$dbselect = mysql_select_db('data', $conn);
if(!$dbselect) {
die('Couldn\'t use database: ' . mysql_error());
}
Interesting because I don't see anywhere in your code where you're querying a 'data' table. If it couldn't find the database it would give you Unknown database 'data'
not Table 'data' doesn't exist
.
Is that all of the code or is that just a bit of it? Also, repost your code with the changes.
Not necessarily the problem but this code
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
Should be moved to line 4.
Your query is failing. Try placing this after your query call
if (!$result) {
die('Invalid query: ' . mysql_error());
}
See, for example: http://en.wikipedia.org/wiki/Virtual_inheritance
So class className is a suitable player for "diamond" inheritance.
Yeah, that's a bit easier to follow than what I said but essentially the same :)
It's to solve the diamond inheritance problem where you have a base class, then 2 child classes then a 4th class that inherits from both of the previous classes. If the base class declares a function then there is ambiguity of that function in the 4th class. Declaring the 2 child classes as inheriting virtually will allow the implementation of the base class's to fall through to the 4th class.
hi,
I am a newbie php programmer i dont understand what you mean.
You could please describe in full detail for me please?
May i also ask can you see anything wrong with it looking at the form?
Thank you
genieuk
Frankly there's a lot wrong but let's solve one issue at a time. The steps I'm walking you through are to debug. If error_reporting didn't give you an error then make sure to check your scripts for a "die" or "exit" function.
heh, E_ALL is a PHP constant that tells error_reporting to display all errors, it doesn't mean anything to you. If that doesn't work then if you have command line access type php -l filename
obviously replacing filename with the file that's giving you trouble.
When you get a white page it usually means there was a fatal error and you don't have error reporting turned on. At the top of your script put error_reporting(E_ALL);
(Take this out once you put the site live, you don't want errors showing on your page when you're not developing.
Well if you think of it more this way. Every noun should be a table, properties of that noun should be a column in said table. Ie., A customer would be a table and it has an id, and a name, etc. inf. Things that are that noun are a row in that table so if there are 4 customers lined up that's 4 rows in the customer table, not 4 tables since they're all customers just different values for their properties.
Ok so what i get from that is i should have a central login table which includes the company_id when create a _session with it. then with all of the data on another table i should include the company id so that i can recal it later?
Like I said, that's just an example. I'd have to see what your current design is to know how to fix it.
I'd be willing to bet there is a major design flaw if every customer having their own table is the solution. Relational databases are relational for a reason so tables can form relationships based on primary and foreign keys.
these tables for example (not real SQL commands, just examples)
Customer
id INT(10) AUTOINC PK --
name VARCHAR(50) |
|
CustomerCompanyMap |
customer_id FK ----------'
business_id FK ----------.
|
Business |
id INT(10) AUTOINC PK ---'
name VARCHAR(50)
Creates a many to many relationship between companies and customers (companies can have many customers and customers can have many companies)
... ... .. why does every customer have their own table?
Oh.... so that works... ok, i learnt something new today. thanks!
but for me to use that will mean breaking up old code and base classes... =(
I think I can proceed from here now. thanks alot for your help.
Well you don't have to use that. The basic concept to learn is that when using dynamic variables with __get and __set its usually better practice to use a holder variable so you have better separation of class variables and dynamic variables.
If you're doing a container of sorts where you dynamically add variables and get them you might want something like this.
class Container
{
private $holder;
public function __get($key)
{
return isset($this->holder[$key]) ? $this->holder[$key] : false;
}
public function __set($key, $value)
{
$this->holder[$key] = $value;
}
public function toArray()
{
return print_r($this->holder, true);
}
}
finally! I actually given up on this thread because I thought no one would come inside a thread so many replies.
thanks for the insight ShawnCPlus. Unfortunately, that function doesn't do what I want. because it does not accept an object. maybe I phrased my question wrongly.
$object = new MyClass();
// after some funny operations
// that dynamically creates more member variables
$var = get_class_variables($object); //error.I'll look up "Reflection" on PHP first. thanks!!
it's actually get_class_vars, not get_class_variables.
If that still doesn't work try
$var = get_class_vars(get_class($object));
wow, that's a lot of ranting without actually answering his question.
$vars = get_class_vars('Class');
// or
$vars = get_class_vars(new Class());
There are more in-depth methods (see Reflection in the PHP manual) but this will get the job done
... ... ... holy crap what the heck are you doing? You just crushed an ant with Mt. Everest.
If you're trying to remote the $
$string = str_replace('$', '', $price);
In regular expressions $ is not a reference. It means End of Line. so the regex s$
would match a line with s at the end. You can escape it just like any other character with a backslash.
That looks suspiciously like a homework question. Perhaps you should give a shot at coding it a bit yourself before we give you a hand.
In all browsers that's how it is supposed to work. Sessions are saved to cookies which either expire after a certain amount of time or after a user closes their browser. There would be absolutely no way to tell the difference between them opening a new tab or just refreshing the page so you're effectively SOL
heh, I guess I'm just not understand how you're not getting it. You can do 4 + 0 = 4 and you can do 0 + 4 = 4 but for some reason you can't do 2 + 2 = 4. You have the two pieces of the puzzle, you're just not putting them together.
Set the cookie
$some_array = array('Hello' => 'World');
setcookie('some_cookie', serialize($some_array), time() +3600);
Retrieve the cookie
$some_array = unserialize($_COOKIE['some_cookie']);
That is correct, you're not lost. You get
a:3:{s:5:"apple";s:5:"green";s:6:"orange";s:6:"orange";s:6:"banana";s:6:"yellow";}
from print serialize($data);
and you get Array
from echo $next
As a side note, don't mix echo and print, there's no reason to, they do the same thing.
use serialize and unserialize instead of implode/explode