Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 months ago.
Improve this question
<img src="./images/w.jpg">
Hello, I'm new to coding and I was wondering how can I make a custom link with an user ID directly taken from my database. The name usersId is a column in a mySQL table and I take that usersId from a session. Can you please help me fix the problem
I tried to use a $_SESSION to insert the user id in the link but it seem that it didn't work and when I open a session on my website it just removes the $_SESSION and give me a link without the user id at the end.
You need to break out of the PHP mode in order to echo the session variable:
<a href="https://123.com/<?= htmlentities($_SESSION['usersId']) ?>" target="_blank">
<img src="./images/w.jpg">
</a>
Note that I also used htmlentities() to encode the ID as an HTML attribute value, to avoid XSS vulnerabilities.
I strongly recommend you do not learn HTML by writing it as strings in PHP - learn proper HTML first, then inject dynamic values with PHP where needed. Mixing the two like you did just leads to a mess.
Have you defined your session object?
It should look like this;
$_SESSION["userId"] = your_mysql_object["userId"]
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am trying to create an image that changes dependent on the genre grabbed from an icecast server, I am pretty sure I have the base code correct I think I've just incorrectly inputted the PHP variable.
<?php
$stats = $core->radioInfo( "http://http://sc.onlyhabbo.net:8124/status-json.xsl" );
?>
<img src=http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif/>
is the full code. Have I inputted the PHP variable incorrectly
Where are the quotes in your Html?
<img src="http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif"/>
UPDATE EVERYBODY
This is now resolved, I decided to go down the CURL route for this, and at first it didn't work until my host raised our CloudLinux Process Limit. I am unsure what the actual issue with this code was, but the CURL route works fine. Thank you for any answers
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I'd like my web page to say "Welcome, [Google+ name here]!"
and so I've been looking around for a solution and checking whether or not it is possible to do it without asking him/her to log my website through Google+.
Looking around for it I found some libs:
require_once 'google-api-php-client/apiClient.php';
require_once 'google-api-php-client/contrib/apiOauth2Service.php';
Are these useful to my purposes? And the main question is: is what I wanna do possible (tips?)?
Thanks in advance.
No, that isn't possible. If you want to know who the user is, you'll have to have them provide access to that information via sign-in or with an OAuth scope that allows you to query for their basic profile information.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
In one of the company while giving interview as a PHP Developer.
He asked me, How to pass variable in jQuery without using name
attribute , id and class??
Yes, you can mention the element itself.
For example:
<p>This is a paragraph</p>
$("p").text("Test message"); // This will select all p tags.
Your interviewer wanted to know about attribute selectors from you:
Example:
$( "input[value='Foo Bar']" ) //select the input which value is 'Foo Bar'
Yes ,there are many selectors in jquery read here
EXAMPLE
$('input[type="text"]').val();
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
So I have a member based website that I submitted to Google. I suppose I accidentally submitted the url with had member's info on it.
For example.
Normal website url.
http://www.mywebsite.com
Submitted website url.
http://www.mywebsite.com
I have a signup form on the index page. And I believe I accidentally used the url when those fields were filled in the input.
So now, the www. extension is associated with those input fields. Every time I use www.mywebsite.com, those input fields with info show up; where if I just use mywebsite.com, the fields will return empty.
I re-submited my website to Google with input fields empty. Hopefully that does the trick, but I am not 100% on that.
What you think?
The best thing is to wait till Google recrawls your website. Other than that you can add your website in Google Webmaster Tools and try to play with it.
Just resubmit your website to google using webmasters tool.. And wait till its indexed again
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I have a piece of code used to search a database for videos based on keywords. It then pulls the url from column $url. I then want to echo out a hyperlink to the video by echoing the website link and concatenating on the url variable pulled from the database.
So far I've come up with the following code. I'm new to php so im not sure how to concatenate variables in an echo.
echo "Link";
Also when I run this code the link brings me to http://danu6.it.nuigalway.ie/sm4business/danu6.it.nuigalway.ie/sm4business
Any help or resource that could help me to fix this would be appreciated.
You need to use dot to concate constant string with variables:
echo ''.$name.'';
for security reason you need to take care about propper variable escaping. Check php.net doc for htmlspecialchars and htmlentities
you can try something like this:
echo "Link";
or you can concat the $url value in the string like this:
echo "Link";
Hope it helps!