[Solved] Login PHP it’s not working [closed]

You have many errors in your code : $result = mysql_query(“SELECT * FROM utilizatori WHERE username=”” . $loginUsername . “” and parola=””. $loginUsername.”””); You check username and parola on same var. You probably want : $result = mysql_query(“SELECT * FROM utilizatori WHERE username=”” . $loginUsername . “” and parola=””. $loginPassword.”””); You are also affecting vars … Read more

[Solved] PHP Session ID issue [closed]

You have one fundamental problem: if ( !isset( $_SESSION ) ) $_SESSION = null; if ( ( !is_array( $_SESSION ) ) xor ( !isset( $_SESSION[‘nzshpcrt_cart’] ) ) xor ( !$_SESSION ) ) session_start(); You can’t access the session before it is started. Try starting it and then accessing it… Also xor is a bitwise comparison…I’m … Read more

[Solved] I want to print age in my bill from dob. dob is stored in $_SESSION but its not printing the age in html page

<?php session_start(); ?> <?php $dob = $_SESSION[‘dob’]; ?> <html> <head> </head> <body> Age:<?php $from = new DateTime($dob); $to = new DateTime(‘today’); echo $from->diff($to)->y; ?> </body> </html> You didnt start the session on that page. And I changed new DateTime(‘$dob’) to new DateTime($dob) because is variable. 0 solved I want to print age in my bill … Read more

[Solved] Update the Session value from database [closed]

If I understood the question correctly you want to read a value from a Database. I assume, you have got an id, stored in $_SESSION[‘Auth’][‘ID’], that provides the User ID of the user in the Database. First you request your new Value from the Database (Notice that I need to know the ID of the … Read more

[Solved] session variable vs normal variable? [closed]

Where is the value stored? That depends on the PHP configuration. By default, session variables are serialized and written into a file on the server’s file system. On each page view that starts the session, they are unserialized and accessible from the $_SESSION array. It’s possible to override the default session handler so that you … Read more

[Solved] how can I print multiple services in this way

You insert services/prices as another array. So use this and it will be ok: I want to print both result in php In file A $_SESSION[‘cart’][‘prices’][] = ‘1000’; $_SESSION[‘cart’][‘services’][] = ‘game’; In File B $_SESSION[‘cart’][‘prices’][] = ‘2000’; $_SESSION[‘cart’][‘services’][] = ‘game2’; In file C foreach ($_SESSION[‘cart’][‘services’] as $key => $service) { echo $service . ‘ = … Read more